<div dir="ltr">Hi, In my python script I'm using the combine() function to merge a protein and a molecule into one model and since I'm doing this multiple times and only use the combined result to save it with pdbWrite I want to free the memory of the object combination right after that, but after the instructions chimera.openModels.close(combination), del combination, chimera.update.checkForChanges(), gc.collect(), chimera.closeSession() the memory is not freed. This is the code that reproduces the problem, it uses the molecules in the zipfile I have attatched.<div><br></div><div><div>import chimera</div><div>from Combine import combine</div><div>import zipfile</div><div>import time </div><div>import gc</div><div>import os </div><div>#from memory_profiler import profile</div><div><br></div><div>for itemnum in range(3):</div><div><span style="white-space:pre-wrap">       </span>#@profile</div><div><span style="white-space:pre-wrap">        </span>def pathmaker(itemnum):</div><div><span style="white-space:pre-wrap">          </span>dirpath = os.path.dirname(os.path.realpath(__file__))</div><div><span style="white-space:pre-wrap">            </span>zippath=dirpath+'/'+'test1_000.zip'</div><div><span style="white-space:pre-wrap">              </span>torsionpath=zipfile.ZipFile(zippath).extract('Pathway_000_Pathway.txt')</div><div><span style="white-space:pre-wrap">          </span>proteinpath=zipfile.ZipFile(zippath).extract('Protein_000_Protein.mol2')</div><div><span style="white-space:pre-wrap">         </span>ligandpath=zipfile.ZipFile(zippath).extract('Ligand_000_Ligand.mol2')</div><div><br></div><div><span style="white-space:pre-wrap">           </span>opened = chimera.openModels.open(proteinpath)</div><div><span style="white-space:pre-wrap">            </span>protein = opened[0]</div><div><span style="white-space:pre-wrap">              </span>opened1 = chimera.openModels.open(ligandpath)</div><div><span style="white-space:pre-wrap">            </span>mol=opened1[0]</div><div><span style="white-space:pre-wrap">           </span>combination=combine([mol,protein],protein)</div><div><span style="white-space:pre-wrap">               </span>totalnum=str(itemnum).zfill(3)+'_'+str(i).zfill(3)</div><div><span style="white-space:pre-wrap">               </span>chimera.pdbWrite([combination], chimera.Xform(), 'testpdb%s.pdb' %totalnum)</div><div><span style="white-space:pre-wrap">              </span>print('writing testpdb%s.pdb' %totalnum)</div><div><span style="white-space:pre-wrap">         </span>chimera.openModels.close(combination)</div><div><span style="white-space:pre-wrap">            </span>del combination</div><div><span style="white-space:pre-wrap">          </span>chimera.update.checkForChanges() </div><div><span style="white-space:pre-wrap">               </span>gc.collect()</div><div><span style="white-space:pre-wrap">             </span>chimera.closeSession()</div><div><br></div><div><br></div><div><span style="white-space:pre-wrap"> </span>for i in range(20):</div><div><span style="white-space:pre-wrap">              </span>pathmaker(itemnum)</div><div><span style="white-space:pre-wrap">       </span>#this stops the code and shows memory increase for each iteration</div><div><span style="white-space:pre-wrap">        </span>print('pause 6 seconds...')</div><div><span style="white-space:pre-wrap">      </span>time.sleep(6)</div></div></div>