I don't know what is wrong in this particular scenario.. but all I have to say is....
Memory leaks should be taken very seriously and should be hunted down and exterminated with extreme prejudice. Yes, Python has built-in garbage collection, but is way to easy to create circular references between objects (parent references child, child references parent)... Once that circular reference is created between two objects, the objects will never be garbage collected by Python, and thus, a memory leak is born. If the code that spawns those circular references gets called over and over again (very common if its part of SQL read/writes), the problem won't get "fixed" until the app uses up all available RAM in the OS, crashes, and a system admin (or script written by the admin) "reboots" the app to start the cycle all over again. There is nothing worse than a slow memory leak that uses up all your system memory over the course of days, weaks, (even months depending on usage) and eventually crashes your site and/or your OS. (This is happening to me now with a Zope/Plone app of mine.) The problem is so hard to find, debug, and fix, that my current solution is to simply reboot my Plone app every week to "fix" the memory leak problem. Very crufty and I hate it. The best solution for fixing memory leaks is prevention and early detection. ... and treating them like the evil cancer cells that they are. On that note, good luck, and have a nice day! :-) - Jason

