[Twisted-Python] Woven application, objects not collected.

Jp Calderone exarkun at intarweb.us
Tue Nov 25 09:12:24 EST 2003


On Tue, Nov 25, 2003 at 02:56:26PM +0100, Syver Enstad wrote:
> [snip]
> 
> The deferreds that are leaking are coming from pb (aReferenceable.callRemote).
> 
> I think that a minimal test case to show the problem would be: (I'll test this later, I have to go in five minutes time).
> 
> Pseudo code:
> class Page:
>    def initialize(self, ...):
>        self._deferred = defer.succeed([1, 2, 3])
> 
>    def wmfactory_oneTwoThree(self, request):
>        return self._deferred
> 

  Presumably at some later point you will have a line like
"self._deferred.callback(value)".  Immediately after this (actually, before
is preferable, how is left as an exercise for the reader), you should
"self._deferred = None".  The cycle will be broken and the garbage will be
collectable.

  Jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031125/6d63e847/attachment.pgp 


More information about the Twisted-Python mailing list