|
From: SourceForge.net <no...@so...> - 2005-08-15 18:09:18
|
Bugs item #1256258, was opened at 2005-08-10 16:19 Message generated for change (Comment added) made by kingb You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=505345&aid=1256258&group_id=63836 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Output: CreateDBAPI Group: v0.2 >Status: Closed >Resolution: Fixed Priority: 9 Submitted By: Brandon King (kingb) Assigned to: Brandon King (kingb) Summary: DBAPI Memory Leak Initial Comment: Pymerase DBAPI has a memory leak where if you have two DBAPI objects (lets say A and B) and you call A.appendB(B) and then call del on B, it won't destory B... This actually shouldn't happen, because if your still holding on to A, then A should still hold on to B. But if you call del on A and B, neither will actually be deleted because this have references eachother and them selves. The solution for is too fold... First using a weakref from each object to itself head in the right direction. Second, a function will need to be implemented such as B._destroySelf() to tell it you want to remove it from memory (which is needed if you commit a large number of Bs and you're try to free up some memory by not holding on to all previously commited B objects). This function _destroySelf() would tell B to go to all associated objects and remove any referrences to itself. Then you would call del B to really remove the object from memory. ---------------------------------------------------------------------- >Comment By: Brandon King (kingb) Date: 2005-08-15 11:09 Message: Logged In: YES user_id=552216 Fixes for bugs 1256258 and 1256271. Memory leak should now be fixed. Ten test cases have be implemented in tests/TestMemLeak.py... All ten pass currently. I tested for slow down in creating and commiting 10,000 objects to a database. It has a 0.2 sec slow down in a 94 sec time frame. The fix includes an object cache which reuses objects which have already been pulled into memory (using weakrefs). Also, there is a new function for DBClass objects called _destroySelf. This function must be called before calling del on an DBClass object. This is only useful when you want to free up some memory when your done with a DBClass object, but the program is going to continue to run. It works by removing all references to the class your trying to remove so that the python ref count will be low enough for garbage collection to free up the memory. Calling del without calling _destroySelf will NOT remove the object from memory. To go back to the memory leaky version check out tag 'pre_aug_2005_mem_patch'. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=505345&aid=1256258&group_id=63836 |