-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Releasing memory from deleted Objc classes #200
Comments
This is technically not a bug, but definitely not ideal behavior. At the moment, rubicon-objc simply doesn't do any automatic Objective-C memory management. This means that all Objective-C calls follow the old rules for manual memory management: every object returned from an So in this case, because It would definitely be better though if rubicon-objc would take care of all retaining and releasing automatically. (See also #48 for some previous discussion on this.) Implementing this shouldn't even be very difficult (it would probably only need some calls to Off-topic: I see you're on macOS 11 - I take it that rubicon-objc is working normally so far on the new OS version? If you run into any compatibility issues because of macOS 11, please let us know 🙂 (especially if you happen to have one of the new ARM-based Macs!) |
btw, if anyone is wondering why I remove and re-add labels on every new issue: GitHub's handling of labels with organization-wide issue templates seems to be kinda broken. The rubicon-objc repo doesn't have its own set of issue templates, so it automatically uses the templates from the beeware/.github repo instead. These templates also include default issue labels - for example, issues created with the bug report template automatically get the "bug" label. But for some reason, it does this by assigning the new issue the actual "bug" label from beeware/.github, which is not the same thing as the "bug" label from beeware/rubicon-objc! This leads to fun issues, like an issue search for "is:issue is:open label:bug" possibly not showing all issues labeled "bug" - because some of them have a "bug" label from a different repo. You can see this if you look at my label change above. The label in "added bug" (on the left, with black text) is the correct label from the rubicon-objc repo, and the label in "removed bug" (on the right, with white text) is the one from the beeware/.github repo. |
Thank you @dgelessus for the detailed explanation. It appears as if |
Regarding macOS 11, I am seeing no issues at all so far. One of the larger changes is how libraries are loaded from the shared cache. But this has been addressed in beeware/toga#1091 and rubicon itself always worked. Unfortunately I am not on an ARM mac, so I cannot help you there. |
Describe the bug
I am not sure if this actually is a bug or intended behaviour. When deleting memory heavy objects on the Python side, the actual memory is not released / returned to the OS. I know that Python sometimes does not give back freed memory, especially in case of small blocks which may be reused later. But this seems different.
Is rubicon-objc hanging on to a reference of those objects somewhere? Or does ObjC just not release the memory when all Python references have disappeared?
To Reproduce
This can be reproduced by loading a 14 MB image into memory and deleting the Python reference to the object:
Expected behavior
I would have expected at least part the 14 MB to be returned to the OS.
Environment:
The text was updated successfully, but these errors were encountered: