-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-117142: ctypes: Migrate global closure freelist to thunk-type state #117874
Conversation
What problem is this solving, and why can't it be solved in a simpler way? I think the closure freelist can stay process-global. The free-threaded build will need some locking (not just for multiple interpreters), but I think closure alloc/dealloc happens rarely enough that a global mutex should be enough. (This is unlike most of Python's freelists, which exist because allocation/deallocation is too common.) We don't free the allocated pages at interpreter shutdown. I don't think that's a big concern, though -- while we don't munmap the pages, we do recycle them. Is there something I'm missing? |
I'm trying to reduce global variables (globals-to-fix.tsv) as much as possible first, then asking for a decision. If you think that the closure (de)allocation is not frequent, |
It would be nice if libffi ( |
This introduces
PyCThunkType_Type
, a metaclass ofPyCThunk_Type
, to bypass the module check during a finish.