-
Notifications
You must be signed in to change notification settings - Fork 10
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
Child container resources are never released #142
Comments
I wonder why you do the registration on the main container and not on the child container (scope). |
Hi @eValker, thank you for reaching out! As @schuettecarsten pointed out, the issue with your test is that in your loop you register the services into the main container, which never gets disposed. You dispose only the child container that doesn't contain any services, so it won't dispose anything. The test would be correct if you pass the child container to the registration method like: Let me know what you think! |
Ah, I see the issue now. Somehow, my brain skipped your explanation about the |
@eValker I've released a new version |
Thank you @z4kn4fein for the fast fix :) |
Hi,
while playing with the library I found an unexpected behavior: resources of child containers are never released and they are being keep in the service's memory even after being disposed.
All problematic resources are being referenced in
disposables
field of the ResolutionScope class.I prepared sample code that reproduces the issue.
After a while we have hundreds of the AnimaRepository instances in the memory:
For testing reasons I have cleaned manually
disposables
field of a main container using a VS debugger and after that all disposed resources were collected by GC.I cannot reproduce this issue while using scopes instead of child containers.
It would be nice to have it fixed because this may lead to memory leak :)
The text was updated successfully, but these errors were encountered: