I'm using Castle Windsor and DynamicProxy to implement persistence Lazy Loading from scratch (I know NHibernate could be an option etc.) I have implemented a custom component activator to always instantiate my business classes as proxies.
I had my doubts concerning the component activator lifestyle (What is the expected LifeStyle of a Castle Windsor component activator?). Krzysztof Kozmic kindly answered that "Every component in Windsor will get its own activator instance".
Faced with a big memory leak in my application I have come to find that an explicit destructor in this class is never called (in my case at least). Is Castle freeing the activators appropriately, namely, when the typed factory is disposed?
Classes
.FromAssemblyContaining(typeof(QuantityType))
.InNamespace(typeof(QuantityType).Namespace)
.WithService.DefaultInterfaces()
.Configure(reg => { reg.Activator<ColMsProxyComponentActivator>(); })
.LifestyleTransient() // We really want new entities every time a new one is requested
As a side note, would it not be useful to have the ability to explicitly declare the component activator lifestyle? In my case, there's no reason why it can't be a Singleton, and that would save some memory and processing.