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

mike bayer mike_mp at zzzcomputing.com
Thu Sep 9 16:40:37 EDT 2004


thats not a weakref of the request object, thats the request object
pointing to a weakref of *your* object, which effectively breaks the
circular reference.

request <-- (strong ref) --
        --- (weak ref) --> yourobject


>
> Mike Bayer wrote :
>>
>> workaround: use a weakref for one side of the circular reference.
>>
>> import weakref
>> req.foobar = weakref.ref(myfoobar)
>
> Indeed, I thought about using a weakref, alas the request object cannot be
> weak referenced (there again, native code must implement a few trick to
> support weak references).
>
> Regards,
>
> Nicolas
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>



More information about the Mod_python mailing list