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
[AC-3673] Android: Optimize removeAllChildren #8026
Conversation
@m1ga Is this now ready for review? cc @ashcoding |
Can one of the admins verify this patch? |
ok to test |
@m1ga if it's good to test, I'll give it a look. |
Yes,please test it. I left some comments in the jira ticket about the listview |
Functionally tested it out. After: |
if (nv instanceof ViewGroup) { | ||
ViewGroup vg = (ViewGroup) nv; | ||
if (TiApplication.isUIThread()) { | ||
vg.removeAllViews(); |
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 original code uses the method remove(child)
to remove the TiViewProxy child view. This in turns call handleRemove()
.
In the handleRemove, the TiViewProxy is released by the method releaseViews()
. This is not done here. Would there be a leak caused from here?
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.
I didn't do any memory checks but according to http://stackoverflow.com/a/29942391/5193915 it will null all child views but it won't call release() on all children, which is the other part of handleRemove(). I'll try to see if I can do some memory testing.
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.
I tried this with 500 views. Prior to this, I get 77,300~ objects after GC (before GC, it was around 121,000). Although it takes a lot of time. With this PR, I get 121,404~ objects after GC. Although it is very fast. In short, the objects are not being released. 😭 |
😢 ok, perhaps there is another way of releasing the objects and still keep the removeAllViews(). Just strange that in my test run the objects went down again. But I'm not that familiar with memory testing so I might have done something wrong |
I'll give this a look again when I have time if I can. |
If you found time to look at this more, do let me know. |
@m1ga any progress here? |
@hansemannn sorry, no. It looks like |
JIRA: https://jira.appcelerator.org/browse/AC-3673