[mod_python] Circular references starting from the request object are not collected

Jorey Bump list at joreybump.com
Thu Sep 9 14:33:31 EDT 2004

Nicolas Lehuen wrote:

> def handler(req):
>     # req.foobar=req

I'm not sure what you're doing, but won't that create a "hall of 
mirrors" effect?


Wouldn't it be better to reset the attribute before storing req?

  req.foobar = []
  req.foobar = req

> If I uncomment the 'req.reqs=[req]' line, the memory leak shows up. My
> Apache process normally uses around 20 MB without the comment, and in 30
> seconds of running the above handler (comment removed) with the above Apache
> Benchmark command, it reaches 125 MB !

More information about the Mod_python mailing list