From: Benjamin Bouvier (
Date: Tue Oct 14 2008 - 10:26:55 CDT

Hi all,

I'm writing a TCL script for VMD which calculates some statistics on a
series of trajectories. These trajectories do not all fit at the same time
in memory (there are too many of them). So what I'm trying to do is to
free up memory after processing each trajectory and before loading the
next one.
Here's how it goes:

1. I load the starting PDB file for each trajectory, then add the
corresponding DCD trajectory:

        cd $coordir
        set startlist [ lsort [ glob *.coor ] ]
        foreach start $startlist {
                cd $coordir
                set mnum [ mol load pdb $start ]
                cd $trajdir
                set traj [ join "[ lindex [ split $start . ] 0 ] dcd" . ]
                mol addfile $traj first $startframe last $endframe step $stepframe
waitfor all molid mnum

2. Then comes some analysis (irrelevant to my problem)...

3. Before going on to the next trajectory, I try to free up memory:

                puts "Done with window $start..."
                animate delete all
                mol delete $mnum

The whole thing seems to work, but memory usage keeps climbing and the
script runs out of memory after 4-5 trajectories... So it seems the "mol
delete" and "animate delete" commands do not release the memory, as I
thought they would.

Any clues ?

BTW: This is VMD 1.8.6 on 64-bit Linux.