On Saturday, January 8, 2011 5:48:06 PM UTC-5, Massimo Di Pierro wrote:
>
> Two ingredients case a memory leak in ANY python program: __del__ and
> circular references. You need them both.
>
> In the case of web2py "exec code in {}" creates the circular reference
> for objects defined in the code. This does not mean web2py has a
> memory leak. In fact, as pointed out, no web2py class has a __del__
> therefore the second ingredient necessary for the leak is missing. The
> leak happens if and only if the developers define a class in model or
> controller that contains a __del__ method. This is the test case that
> mitsuhiko engineered for us.
The __del__ method is a necessary condition only now that you have added
gc.collect(), right? Prior to that change, you could get a leak (because of
exec) even if the class defined in the model or controller did not have a
__del__ method, no?