Opened 7 years ago
Closed 7 years ago
#1471 closed defect (fixed)
AtomicStructure not fully cleaning up memory on close
Reported by: | Tristan Croll | Owned by: | pett |
---|---|---|---|
Priority: | moderate | Milestone: | |
Component: | Core | Version: | |
Keywords: | Cc: | chimera-programmers | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | Linux64 (X11) | |
Project: | ChimeraX |
Description
The real-world scenario here is that I'm running analysis scripts over >1000 models, using some of my tools from ISOLDE. I'm running in GUI mode since ISOLDE's tools aren't tested in non-gui mode (and I save PNG files from Matplotlib - not sure if that would work in non-gui mode anyway...). But the minimal test that replicates the problem is:
pdb_ids = #Some list of a few dozen PDB IDs (or filenames) from chimerax.core.commands import open as cxopen for i in range(10): for pdb_id in pdb_ids: cxopen.open(session, pdb_id) session.models.close(session.models.list())
Dumping a memory map of the process shows a large number of anonymous ~64MB blocks:
Address Kbytes RSS Dirty Mode Mapping 0000000000400000 4 4 0 r-x-- ChimeraX 0000000000600000 4 4 4 r---- ChimeraX 0000000000601000 4 4 4 rw--- ChimeraX 0000000002515000 443132 405040 405040 rw--- [ anon ] 00000000401ab000 1288 1288 1288 rw--- [ anon ] 00000000404a9000 1288 1288 1288 rw--- [ anon ] 0000000040aaf000 644 644 644 rw--- [ anon ] 0000000040b86000 8 4 0 r-xs- .glU5NXLN (deleted) 0000000040bdd000 644 644 644 rw--- [ anon ] 0000000040cb9000 644 644 644 rw--- [ anon ] 000000004121f000 644 644 644 rw--- [ anon ] 000000004144d000 644 644 644 rw--- [ anon ] 0000000041833000 644 644 644 rw--- [ anon ] 0000000041c81000 644 644 644 rw--- [ anon ] 0000000041e86000 644 644 644 rw--- [ anon ] 0000000041f43000 644 644 644 rw--- [ anon ] 00007fef34000000 64768 64768 64768 rw--- [ anon ] 00007fef37f40000 768 0 0 ----- [ anon ] 00007fef38000000 22356 22356 22356 rw--- [ anon ] 00007fef395d5000 43180 0 0 ----- [ anon ] 00007fef3c000000 65032 65032 65032 rw--- [ anon ] 00007fef3ff82000 504 0 0 ----- [ anon ] 00007fef40000000 63976 63976 63976 rw--- [ anon ] 00007fef43e7a000 1560 0 0 ----- [ anon ] 00007fef44000000 64240 64240 64240 rw--- [ anon ] 00007fef47ebc000 1296 0 0 ----- [ anon ] 00007fef4c000000 64504 64504 64504 rw--- [ anon ] 00007fef4fefe000 1032 0 0 ----- [ anon ] 00007fef50000000 64768 64768 64768 rw--- [ anon ] 00007fef53f40000 768 0 0 ----- [ anon ] 00007fef54000000 65032 65032 65032 rw--- [ anon ] 00007fef57f82000 504 0 0 ----- [ anon ] 00007fef58000000 64240 64240 64240 rw--- [ anon ] 00007fef5bebc000 1296 0 0 ----- [ anon ] 00007fef5c000000 65032 65032 65032 rw--- [ anon ] ... etc.
... some of which seem to slowly clean up over time (in minutes to tens of minutes), but others hang around seemingly indefinitely. It's non-linear as well - on my system memory usage shoots up to 10-15 GB quite quickly, but on the analysis I left running overnight (which has gotten through about 9000 models so far) it's hit an equilibrium at around 27GB. It also seems to be grinding a lot more slowly than in a freshly-started session.
Change History (3)
comment:1 by , 7 years ago
Cc: | added |
---|---|
Status: | assigned → accepted |
comment:2 by , 7 years ago
Actually, the second model being problematic isn't as odd as it seems since the first model is the grouping model. So, it's the first AtomicStructure that's not going away...
comment:3 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The code added by the mmCIF and PDB readers to annotate their models as having formattable metadata resulted in a circular reference. Fixed now.
Something funky going on. If I open 1mtx (an NMR ensemble) and then:
from weakref import ref
wrefs = [ref(x) for x in session.models]
on command line: close
then:
[x() for x in wrefs]
yields all None except for the second(!) model in the list. Will investigate further.