<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">This seems to be a memory leak in Chimera. Using the 1.3 production release (1.3.2577) the weak key dictionary discards entries as they are closed, but with the 1.4 production release (1.4.1) and later the entries accumulate in the dictionary. That means that some code somewhere in Chimera is holding onto a reference to the closed model, preventing it from being destroyed and its memory freed (and its weak-key dictionary references from being deleted).<div><br></div><div>This is why your "flush cache" trick helps some but doesn't completely solve the problem: the closed models aren't freeing up memory like they should. I will be investigating this and will post something here when I've fixed it, but memory leaks are pretty difficult to track down so it might take until sometime next week for me to find/fix it.</div><div><br></div><div>--Eric</div><div><br><div><div>On Jul 28, 2011, at 11:24 AM, Maciek Wójcikowski wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello Eric,<div><br></div><div>My script is quite simple, but I'm not an python expert:<div><div><br></div><div>#! /usr/bin/env python</div><div># -*- coding: utf-8 -*-</div><div><br></div><div>import os</div><div>import glob</div> <div>import sys</div><div><br></div><div>if len(sys.argv) < 2:</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>print 'No directory specified.'</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>sys.exit()</div> <div><br></div><div>path = sys.argv[1]</div><div><br></div><div>from chimera import runCommand</div><div>runCommand("open 0 model.mol2")</div><div><br></div><div>i=0</div><div><br></div><div>for files in glob.glob( os.path.join(path, '*.mol2') ):</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>#print path+files</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>runCommand('open 1 %s' % files)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if i < 100:</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>cache = " cacheDA true"</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>else:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>cache = ""</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i=0</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>try:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>runCommand("hbonds intramodel false distSlop 0.8 angleSlop 40" + cache )</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>except:</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>pass</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>runCommand("close 1")</div> <div><span class="Apple-tab-span" style="white-space:pre"> </span>i+=1</div></div><div><br></div><div>I've added the "non-cache" run every 100 iterations, since I've noticed in source code that non-cache hbond check trigers flushCache() and it seams to help. When I previously had all iterations with "cacheDA true" chimera was eating RAM like a beast (up to about 2GB per 100.000 molecules) making the cache searches slow. It would be ideal to have cached only those D+A from the model (protein).</div> <div><br></div><div>Some tech. details: Chimera 1.5.3, Fedora 14, CentOS 6.0, Debian Sid - all have this problem.</div><div><br></div><div>PS. </div><div>Is it possible to get the number of donors and acceptors somehow? Or should I add this to the source code? It can be achieved easily since it counts them, but doesn't print such number.</div> <div><br></div><div>Thank you in advance for your help.</div><div>----<br>Pozdrawiam, | Best regards,<br>Maciek Wójcikowski<br><a href="mailto:maciek@wojcikowski.pl" target="_blank">maciek@wojcikowski.pl</a><br> <br><br><div class="gmail_quote">2011/7/28 Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu">pett@cgl.ucsf.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <div style="word-wrap:break-word"><div class="im"><div><div>On Jul 28, 2011, at 3:35 AM, Maciek Wójcikowski wrote:</div><br><blockquote type="cite">Hello everyone,<div><br></div><div>I'm trying to compute hbonds for quite large molecular database, so i do it in CLI. I've added cacheDA parameter which speeds up whole process at first by 10 times, although after time cache is getting bigger and bigger operations slows down as one can expect, because Chimera is caching every compound. Is there a way to limit the size of a cache, or even better to tell chimera to cache only protein donors and acceptors?</div> </blockquote><br></div></div><div>Hi Maciek,</div><div><span style="white-space:pre-wrap"> </span>Are you closing the compound models after you do the H-bond computation? I ask because the caching uses a "weak key dictionary" where the key is the model. What this means is that if the model is closed it should simply disappear from the cache, no fuss no muss. If you <i>are</i> closing the models then either the slowdown is due to something else, or the models aren't being properly removed from the cache. Let me know if your script is closing the models but still having this problem and I will investigate.</div> <div><br></div><div>--Eric</div><br><div> <span style="border-collapse:separate;border-spacing:0px 0px;color:rgb(0, 0, 0);font-family:Helvetica;font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="word-wrap:break-word"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> <span> </span></span>Eric Pettersen</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "> <font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> <span> </span></span>UCSF Computer Graphics Lab</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> </span><a href="http://www.cgl.ucsf.edu" target="_blank">http://www.cgl.ucsf.edu</a></font></div> <br></div></span> </div><br></div></blockquote></div><br></div></div></blockquote></div><br></div></body></html>