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

Transient MappingEngines won't be garbage collected with a singleton Configuration #136

Closed
gwilson2151 opened this issue Oct 21, 2011 · 2 comments

Comments

@gwilson2151
Copy link

If your configuration is a singleton and you are using MappingEngines transiently as suggested here those MappingEngines won't be gc'ed. When constructing the MappingEngine it associates itself with the configuration via the EventHandler below and never disassociates itselfs from the configuration and as a result there's always a reference to the MappingEngine. Zombie MappingEngines!

public MappingEngine(IConfigurationProvider configurationProvider)
{
    _configurationProvider = configurationProvider;
    _mappers = configurationProvider.GetMappers();
    _configurationProvider.TypeMapCreated += ClearTypeMap;
}
@jbogard
Copy link
Member

jbogard commented Dec 11, 2011

I've made IMappingEngine implement IDisposable to un-subscribe from these events. This should make MappingEngine back to the land of the living, let me know if it doesn't!

@lock
Copy link

lock bot commented May 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants