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
fix(ios): remove additional gc protection once proxy is remembered #11028
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look OK to me. I'm going to trust you know the object lifecycle in detail better than I do here, so 👍
@janvennemann when I tested the pr with the alloy app attached and sample code on the PR . still memory is not released on some devices
Adding instrument file for iPhone 5 iOS 10 alloy and classic app and iPhone X alloy trace for reference . Can you please look at it . |
@keerthi1032 i've added a temporary debug function that should make this easier to verify. However, I don't have a device with iOS 11 or lower at hand, so could you please give this another try? Add the following code to the examples and it will trigger a forced garbage collection after 30 seconds and object count should update. setTimeout(() => {
Ti.App.iOS.garbageCollectForDebugging();
}, 30000); I've tested this with an iPhone X running iOS 12.4 and iPhone 6s running iOS 12.1 and the object count updated as expected for the classic and alloy examples. |
We still see regular app freezes with this pull request, unfortunately it does not help so far. Even worse, it seems like freezes are not caught as crashes, so it's hard to report from outside. |
FR Passed. Objects are getting GC'ed as expected. Some stay persistent for few minutes & then gets GC'ed. Studio Ver: 5.1.4.201909061933 |
JIRA: https://jira.appcelerator.org/browse/TIMOB-27207
Optional Description:
To protected JS objects after creation and while they are not referenced on the stack or in the JS object graph we introduced
applyGarbageCollectionSafeguard
. The GC protection is removed in https://github.com/appcelerator/titanium_mobile/blob/58c26e10d4641d36b7ac7f28fd61fd0ecb9d394e/iphone/TitaniumKit/TitaniumKit/Sources/API/TiBindingTiValue.m#L202 when a value crosses the native bridge. This works fine for statements likeconst table = Ti.UI.createTableView()
.However, this can cause issues for some internal values, like the
TiUITableViewSectionProxy
of a table view. Unless you explicitly access that section in your code (which will force it to cross the native bridge, e.g.const section = table.data[0]
) it will remain GC protected. Since we already make sure that those proxies don't get GC'ed by usingrememberProxy
, this fix will remove the creation time GC safeguard in this method too.Testing steps
tiui
.TiUITableViewRowProxy
andTiUITableViewSectionProxy
entries show up with an increasing number of persistent objects.