Opened 8 years ago
Closed 8 years ago
#1007 closed defect (fixed)
AtomicStructures not freed when closed
Reported by: | Greg Couch | Owned by: | pett |
---|---|---|---|
Priority: | major | Milestone: | 0.7 |
Component: | Core | Version: | |
Keywords: | Cc: | chimera-programmers@… | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
The attached program, slowleak.py, shows what objects stick around after the structure is closed. In particular, the structure sticks around. 3 scenarios were explored, a structure with just waters (attached waters.cif), one with just a few nucleotides (3rec), and a large protein (2hmg).
After making the attached patch to atomic/structure.py to clear the list of trigger handlers when deleted, the waters test works, but the others still fail.
Here is a table of the references counts for the structure, (1) after returning from C++ and creating the AtomicStructure object, (2) after returning from commands.open(), and (3) after returning from commands.close(), garbage collecting, and checking what remains:
waters 3rec 2hmg after C++ 8 8 8 after open 12 14 25 after close 0 3 14
The reference counts include the reference as an argument to sys.getrefcount and of the object in the scope that sys.getrefcount was called in.
The structure patch eliminates a circular reference path, the lambda with the bound method self._ses_call hold a reference to the structure and _ses_handlers in the structure keep track of them. It is unclear why this is too complicated for Python's garbage collector in the water's case. So I'll commit that change.
Not sure where to look next.
Attachments (4)
Change History (9)
by , 8 years ago
by , 8 years ago
Attachment: | struct.patch added |
---|
by , 8 years ago
Attachment: | mmcif_debug.patch added |
---|
by , 8 years ago
Attachment: | slowleak.py added |
---|
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Summary: | AtomicStructures do not disappear when closed → AtomicStructures not freed when closed |
---|
comment:3 by , 8 years ago
Component: | Unassigned → Core |
---|---|
Priority: | blocker → major |
comment:4 by , 8 years ago
Milestone: | 0.6 → 0.7 |
---|
comment:5 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
ctypes handling of non-array python objects was leaky
More information:
All tests were done with "ChimeraX --exit --nogui slowleak.py".
On Linux, there is one unknown "cell" reference to the AtomicStructure left over, and adding "self.triggers = None" in Structure.delete gets rid of it. That problem does not show up on Windows. So all of the rest of the references appear to be from the C++ layer.