-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
ctypes array types create reference cycles #77448
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
Comments
Discovered in https://github.com/numpy/numpy/pull/10882/files#r180813166 A reproduction:
Using the proposed function in numpy/numpy#10891, we get a few more details:
I suppose this isn't really a bug, but it's not clear to me why a cycle needs to be created here. |
Apologies, I missed the important part of that snippet:
|
Pretty sure this is a problem with classes in general; classes are self-referencing, and using multiplication to create new ctypes array types is creating new classes. |
Indeed, most classes create reference cycles. >>> gc.collect(); x = type('Class', (), {}); del x; gc.collect()
5
>>> gc.collect(); x = type('Class', (), {'list_with_set': [{}]}); del x; gc.collect()
7 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: