Graham Dumpleton
grahamd at dscpl.com.au
Mon Mar 28 17:37:31 EST 2005
On 29/03/2005, at 12:49 AM, Nick wrote: > Daniel Popowich wrote: >>>> The problem is that even though one sets self.session to None, >>>> this doesn't mean it will be deleted immediately as one is in part >>>> at the mercy of the Python garbage collector. > [...] >> Thanks for digging into this Graham. Yes, I thought this would be >> sufficient: >> self.session.save() >> self.session = None >> as the garbage collector would clean up the session. > > I have noticed that even calls explicitly to gc.collect() don't > necessarily do the job, either... so in general, if you've got an > object with an explicit __del__ method, it's best to del it > explicitly. As already mentioned in a followup to that original email, it turned out not to be the garbage collector as there was still a reference to the object held by the cleanup function registered for the session. http://www.modpython.org/pipermail/mod_python/2005-March/017775.html Registration of a request cleanup function for session objects was apparently introduced in 3.1.3 based on some old mail in the mailing list from Grisha that I found. Graham
|