Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Castle Windsor - Why would I not want to use 'NoTrackingReleasePolicy' as default?

I come from the StructureMap world, where it is never necessary to release resolved transient objects.

I see that Windsor by defauly keeps track of any resolved transient objects and therefore prevents them from being garbage collected until they are released (if they ever are released).

I found NoTrackingReleasePolicy in the docs, but it's usage is discouraged.

Having to release any transient objects seems like going back in time to me.

I will use NoTrackingReleasePolicy in my app.

What trouble am I getting into by doing this? Or in other words why would I want to release objects manually instead of having the garbage collector handle that for me?

like image 983
santiagoIT Avatar asked Oct 23 '11 21:10

santiagoIT


1 Answers

Just so that question doesn't stay unanswered:

The matter is explained in the blogpost linked by @mauricio scheffer in the comments.

Basically using NoTrackingReleasePolicy is going to lead to a lot of subtle problems, and if you architect your app right, with the default release policy, you don't have to worry about calling release explicitly in your code anyway.

like image 189
Krzysztof Kozmic Avatar answered Sep 23 '22 02:09

Krzysztof Kozmic