Just my 2 cents observation...
I ran this code and monitored the page "Cache extreme detail" in ZMI >
ControlPanel > DebugInfo.
With this method, the object was not loaded. However the intermediate
objects that the unrestrictedTraverse() passed by were loaded into memory.
e.g. If doc.getPath() is '/x/y/z/myobject', myobject was not loaded but x,
y, and z were loaded into memory.
This is a good point, and for catalog based retrievals of objects may be difficult (but not impossible) to avoid excess objects remaining in the cache. If however you are doing a walk of part of your ZODB tree (unlike 'randomly' accessing objects from the ZODB like this) you could ensure that you do a depth first traversal, then as you come back up the tree, traversed nodes that weren't active before the walk would be deactivated.

eg something like this external method :

def traverseTree(self):
    ''' Traverse the tree and do something. '''

was_ghost = self._p_changed is None

    for ob in self.objectValues():

    # XXX Do something with self here :

if was_ghost:self._p_deactivate()

This should ensure that any 'traversed over' nodes that were previously not active are de-activated.


Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to