Skip to content
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

Deduplicate StickyClass GC roots #2324

Merged
merged 1 commit into from
Apr 3, 2022
Merged

Deduplicate StickyClass GC roots #2324

merged 1 commit into from
Apr 3, 2022

Conversation

pyricau
Copy link
Member

@pyricau pyricau commented Apr 2, 2022

System classes are GC roots and tracked by GcRoot.StickyClass. We've seen heap dumps from API 23 emulators that included millions of sticky class roots, pointing several times to the same instances. As we keep the list of roots in memory, this wasted a lot of memory and slowed down the sorting of gc roots which happens right before path finding. This change fixes this by deduplicating StickyClass GC roots based on their ids.

@pyricau
Copy link
Member Author

pyricau commented Apr 2, 2022

shark.HprofRetainedHeapPerfTest > freeze retained memory when indexing leak_asynctask_m FAILED
    java.lang.AssertionError: 
    Expecting:
     <4890760>
    to be between:
     [7789999, 8609998]

Android M = API 23, so of course we're using less memory now.

System classes are GC roots and tracked by GcRoot.StickyClass. We've seen heap dumps from API 23 emulators that included millions of sticky class roots, pointing several times to the same instances. As we keep the list of roots in memory, this wasted a lot of memory and slowed down the sorting of gc roots which happens right before path finding. This change fixes this by deduplicating StickyClass GC roots based on their ids.
@pyricau pyricau merged commit 775de4d into main Apr 3, 2022
@pyricau pyricau deleted the py/dedup_stickyclass branch April 3, 2022 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant