From: Axel Kohlmeyer (
Date: Wed Jan 06 2010 - 22:22:56 CST

On Wed, Jan 6, 2010 at 9:48 PM, Wayne Dawson <> wrote:
> Are you running some tcl script on the data?
> Commands like "atomselect" do not know when you want to do clean up (garbage
> collection) so they just accumulate massive amounts of memory on a huge file
> like that.  It would bring the OS to a halt.  You need to include "delete"
> somewhere in your script if that is the case.


while your warning about "deleting" atom selections is adequate, the explanation
for it, is way off. there is no "garbage collection". tcl does
reference counting and
will free allocated objects automatically when the reference count becomes zero.

the fact that people often run into a memory problem with atom selections stems
from _memory leaks_ (or rather atom selection leaks). the atomselect comand
will create a uniquely named new procedure and return its name. since this name
cannot be easily known in advance, scripts assign the return value
from atomselect
to a variable. this will act like a pointer variable. if you assign it
a new atomselect
procedure name, before deleting the previous one, the name of the previous one
will be lost and thus you will "leak" an atomselection and therefore
have a memory leak.

this is a bit of a simplified view, as there are actually some
mechanism in place
to clean up atom selections automatically similar to local variables, but the
memory/selection leak usually gets out of hand, before this special mechanism
becomes active.


> Wayne

Dr. Axel Kohlmeyer
Institute for Computational Molecular Science
College of Science and Technology
Temple University, Philadelphia PA, USA.