views:

47

answers:

1

I'm interested in knowing if there are any advantages to creating a child container for each request in a web based application?

The tech stack I'm using includes StructureMap & ASP.NET MVC, which is not particularly relevant but included as background info.

A: 

Without a child container, the application container would otherwise be responsible for holding all instances created during the application's lifetime.

That is an enormous memory leak.

Bryan Watts
why is it memleak?
zerkms
Surely this an assumption of how the container is implemented and it disposes of instances?
AWC
@AWC: I am making the assumption that containers, in general, track the instances they create. That is a solid assumption for any implementation of an IoC container, otherwise "container" wouldn't be a very fitting name. I make no assumptions about disposal: I simply mean that if a container goes out of scope, its objects go with it.
Bryan Watts