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

Discussion on unmanaged memory leak #18

Closed
sr229 opened this issue Feb 2, 2022 · 2 comments
Closed

Discussion on unmanaged memory leak #18

sr229 opened this issue Feb 2, 2022 · 2 comments
Labels
area:pinvoke The issue is about PInvoke bug Something isn't working help wanted Extra attention is needed priority:high

Comments

@sr229
Copy link
Member

sr229 commented Feb 2, 2022

Based on what @Speykious and I dug, we narrowed down our memory leak to our managed code not calling the unmanaged deleters, leaving us with dangling pointers that has not been cleared.

Related Literature

@dbruning findings and memory profile shared to us

image

Memory Footprints of MediaPipe natively by @Speykious

image

image

@sr229 sr229 added bug Something isn't working help wanted Extra attention is needed priority:high area:pinvoke The issue is about PInvoke labels Feb 2, 2022
@Speykious
Copy link
Contributor

While memory does leak, after a lot more digging into the MediaPipe code, we actually determined that the cause was not that deleters weren't called, but that we were using non-thread-safe MediaPipe classes in a multithreaded context.
We'll try to recreate an example once SeeShark 3.0 is release as it will expose synchronous functions.

@Speykious Speykious changed the title Deleters are not being called during Disposal Discussion on unmanaged memory leak Feb 17, 2022
@sr229
Copy link
Member Author

sr229 commented Feb 21, 2022

While we solved this already on 5226aef, I wouldn't call it "case closed" as we don't have an assurance we can maintain that it won't leak anywhere. Hence we're closing this only once MUXR has been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:pinvoke The issue is about PInvoke bug Something isn't working help wanted Extra attention is needed priority:high
Projects
None yet
Development

No branches or pull requests

2 participants