AutoMapper/AutoMapper — Issue #136: Transient MappingEngines won't be garbage collected with a singleton Configuration
Author: gwilson2151
Created: 2011-10-21 03:34:42+00:00
State: open

If your configuration is a singleton and you are using MappingEngines transiently as suggested [here](http://lostechies.com/jimmybogard/2009/05/12/automapper-and-ioc/) 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;
}