Briefly speaking, our system uses UsingFactoryMethod in a few places
like the following:

container.Register(Component
                                   .For<SqlRepositoryRegistry>()
                                   .UsingFactoryMethod(k => new
SqlRepositoryRegistry(this.connectionString, _schema))
                                   .LifeStyle.PerWebRequest);

The problem is that although the resolved component gets disposed
after a request ends, it doesn't get released from the container at
all which ends up at memory leak problem. Debugging into Windsor
Castle code show me that the components is tracked in the
container.Kernel.ReleasePolicy object (instance2Burden field). The
ReleasePocily inuse here is AllComponentsReleasePolicy.

Although changing to NoTrackingPolicy can help, it doesn't sound like
a good choice.

What should I do in this situation? I couldn't get why the components
are not released from the container automatically. According to posts
in the internet, they should be, shouldn't they?

More information:
- Windsor Castle version: 2.1.1. And we cannot upgrade to a newer
version right now.
- Only components which are resolved via UsingFactoryMethod are
tracked and are there forever.

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to