Attention: We are retiring the ASP.NET Community Blogs. Learn more >

Contents tagged with Castle

  • Avoid Memory Leaks When Using Windsor And Not Releasing Objects

    I just had this issue in a project I am working on (ASP.NET Webforms Application), yesterday I ran a load test and watched my memory climb rapidly and max out not long after. I am using Castle Windsor for my IOC and mostly transient instances are registered so I did not expect any issues here as I asssumed there would be no references held to my transient instances but the leak shows this is happening.

    I am not releasing my services once done so this is partly my fault but I do not wan't to explicitly release them so I found another way which means setting the ReleasePolicy on the kernel to use the NoTrackingReleasePolicy. The default release policy is the AllComponentsReleasePolicy which from what I can see by debugging will keep track of your instances and you will need to release them manually when you are finished with the item.