
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. import chimera from Combine import combine import zipfile import time import gc import os #from memory_profiler import profile for itemnum in range(3): #@profile def pathmaker(itemnum): dirpath = os.path.dirname(os.path.realpath(__file__)) zippath=dirpath+'/'+'test1_000.zip' torsionpath=zipfile.ZipFile(zippath).extract('Pathway_000_Pathway.txt') proteinpath=zipfile.ZipFile(zippath).extract('Protein_000_Protein.mol2') ligandpath=zipfile.ZipFile(zippath).extract('Ligand_000_Ligand.mol2') opened = chimera.openModels.open(proteinpath) protein = opened[0] opened1 = chimera.openModels.open(ligandpath) mol=opened1[0] combination=combine([mol,protein],protein) totalnum=str(itemnum).zfill(3)+'_'+str(i).zfill(3) chimera.pdbWrite([combination], chimera.Xform(), 'testpdb%s.pdb' %totalnum) print('writing testpdb%s.pdb' %totalnum) chimera.openModels.close(combination) del combination chimera.update.checkForChanges() gc.collect() chimera.closeSession() for i in range(20): pathmaker(itemnum) #this stops the code and shows memory increase for each iteration print('pause 6 seconds...') time.sleep(6)