Hi Tom, Thanks for your help with this memory leak. After looking into it a bit further, it turns out that the leak is with Silva. I'll be asking the silva-general list about this soon :-)
Try adding a "depth" parameter to track the recursion level. For the first iteration, have the method print or otherwise log the list, so you can see what it starts out as.
Thanks for that tip; I've started using it for other recursive scripts since this one. [snip my recursion code]
It looks to me like everything should be released by the time the thing returns from recursion. I would be the most concerned about "queue" and "new_queue" because they seem to have the most potential for keeping references hanging around - who knows what references Zope may construct once the thing returns? So the one thing I would try first is this -
if (context.is_root != 1): return context.aq_parent.getRootedMenuList(new_queue) new_queue = None #just in case ... else: return new_queue
Where does "is_root" come from?
is_root is a property that all 'BethelMenu's have...it's a way for me to determine whether the current menu is the root menu or not, without having to do: if (context.aq_parent.meta_type != 'BethelMenu'): #we know context is the root menu
BTW, you do not need the parens around the condition expressions in the if statements.
Yup. I do prefer parens, though. I feel it helps me separate the expressions better. Thanks, Andy
Cheers,
Tom P
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )