[ZCM] [ZC] 302/ 1 Request "Circular References"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Mon, 18 Mar 2002 13:39:08 -0500


Issue #302 Update (Request) "Circular References"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/302

==============================================================
= Request - Entry #1 by Anonymous User on Mar 18, 2002 1:38 pm

While trying to track down some memory leaks in an application  we built,  I noticed that the Transformer objects in RestrictedPython Scripts are creating circular refernces. 

I discovered this using the gc module and the Monitor Client I found that every time you edited a python script you would get roughly 384 objects that needed to be garbage collected. In other words 384 objects are involved in some sort of circular refernce. This number increases for every line of code you add to a python script.

Editing things like DTML documents produced 0 objects that needed to be collected.

Furthermore I belive under certain circumstances Python Scripts are creating  circular refs when they are loaded into the cache, allthough I have not confirmed this.


Here's the output of a script called Cyclops.py which runs through several object and determines what and how objects are referncing each other. Hopefully it might help.

     6 Transformer()        ._atom_dispatch      -> dictionary
   318 Transformer()        ._dispatch           -> dictionary
     6 dictionary           [256]                -> instance method
     6 dictionary           [257]                -> instance method
     6 dictionary           [258]                -> instance method
     6 dictionary           [259]                -> instance method
     6 dictionary           [260]                -> instance method
     6 dictionary           [261]                -> instance method
     6 dictionary           [262]                -> instance method
     6 dictionary           [263]                -> instance method
     6 dictionary           [264]                -> instance method
     6 dictionary           [265]                -> instance method
     6 dictionary           [266]                -> instance method
     6 dictionary           [267]                -> instance method
     6 dictionary           [269]                -> instance method
     6 dictionary           [26]                 -> instance method
     6 dictionary           [270]                -> instance method
     6 dictionary           [271]                -> instance method
     6 dictionary           [272]                -> instance method
     6 dictionary           [273]                -> instance method
     6 dictionary           [274]                -> instance method
     6 dictionary           [275]                -> instance method
     6 dictionary           [276]                -> instance method
     6 dictionary           [277]                -> instance method
     6 dictionary           [280]                -> instance method
     6 dictionary           [281]                -> instance method
     6 dictionary           [282]                -> instance method
     6 dictionary           [283]                -> instance method
     6 dictionary           [284]                -> instance method
     6 dictionary           [285]                -> instance method
     6 dictionary           [286]                -> instance method
     6 dictionary           [287]                -> instance method
     6 dictionary           [288]                -> instance method
     6 dictionary           [290]                -> instance method
     6 dictionary           [291]                -> instance method
     6 dictionary           [292]                -> instance method
     6 dictionary           [293]                -> instance method
     6 dictionary           [294]                -> instance method
     6 dictionary           [295]                -> instance method
     6 dictionary           [296]                -> instance method
     6 dictionary           [297]                -> instance method
     6 dictionary           [298]                -> instance method
     6 dictionary           [299]                -> instance method
     6 dictionary           [300]                -> instance method
     6 dictionary           [301]                -> instance method
     6 dictionary           [302]                -> instance method
     6 dictionary           [303]                -> instance method
     6 dictionary           [304]                -> instance method
     6 dictionary           [306]                -> instance method
     6 dictionary           [307]                -> instance method
     6 dictionary           [310]                -> instance method
     6 dictionary           [311]                -> instance method
     6 dictionary           [312]                -> instance method
     6 dictionary           [314]                -> instance method
     6 dictionary           [316]                -> instance method
     6 dictionary           [4]                  -> instance method
   324 instance method      .im_self             -> Transformer()

==============================================================