[Zope] Does this create a leak?

Jean-Francois.Doyon at CCRS.NRCan.gc.ca Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Mon May 17 22:21:50 EDT 2004


Hello,

Does setting a persistent object as attribute to another persistent
object, and then accessing it directly through the web, create a leak?

For example:

from OFS.Image import Image

class myclass(Image):

    def __init__(self)
        self.thumbnail = Image(id='thumbnail')

and then access it using something like:

http://host.com/myinstance/thumbnail

Wouldn't this leave the thumbnail lying around after the GC cycle, since
once the system is done with the parent instance, the refcount falls to
zero, it's cleaned out, and the thumbnail is orphaned, creating a memory
leak?

I was told at some point that this was OK, but now that I'm hunting memory
leaks and learning more about that, this no longer seems sensible.

And since I do it all over the place, it'd explain my horrible leak of
AcquisitionWrappers and HTTPRequests and so on ... As well as high refcount
for CMFImage.Image ...

Thanks,
J.F.



More information about the Zope mailing list