[Zope] recursive python script = Memory Leak?
15 May 2003 08:21:25 -0500
I have a hierarchy of folderish objects, and I wish to generate a list
representing it, starting at some arbitrary point in the hierarchy and
working towards the root.
So, I think: recursion is the way to do it. However, any means that I
try to generate this list introduces a memory leak.
Are there any tricks/quirks in recursive python scripts I should know
about? It appears that one section of this list isn't being deleted, so
when the script is called again (i.e. starting the recursive algorithm
again), the list that is initially create is the list from the previous
I'll put the code here so hopefully someone can point out an (obvious)
Oh, the list that I'm building is of the form:
[[object, [objects children]]]
And, it's necessary to have the second outer list.
## Script (Python) "getRootedMenuList_recursive"
#add the siblings
for o in context.objectValues('BethelMenu'):
if (o != queue):
#create a new child_q
new_queue = [[context, queue]]
if (context.is_root != 1):
Thanks for your help!!!!