From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Mon Feb 21 2011 - 10:10:41 CST

On Mon, Feb 21, 2011 at 10:13 AM, Tim Meyer <meyerti_at_gmail.com> wrote:
> dear all,
> in a former thread a memory leak was reported (and reported fixed)
> http://www.ks.uiuc.edu/Research/vmd/mailing_list/vmd-l/16658.html
>
> running a small skript analyzing waters in a trajectory where i loop for
> each frame through all ~1000 water molecules (see below) does however
> accumulate memory (version 1.8.7 and 1.9b1) and leads to a crash after ~20
> frames (1.5GB of RAM)
> i tried to free memory using "unset s" didn't seem to work.

yes. because that only releases the storage for the name
of the atomselect "object".
you have to do:

$s delete

to release the storage allocated by the atomselect command.

axel.

> any suggestions on how to free memory within the loop?
>
> thanks in advance
>
> tim
>
>
>
> mol addfile TRAJ/1cqy.1.netcdf type netcdf first 0 last 999 step 1 waitfor
> -1
> set wat [atomselect top "water and oxygen"]
> mol representation vdw
> mol addrep top
> set num_frame [molinfo top get numframes]
> puts "have $num_frame frames"
> for { set frame 0 } { $frame < $num_frame } {incr frame} {
>  animate goto $frame
>  puts $frame
>  foreach inx [$wat list] {
>    set s [atomselect top "noh and within 3.5 of index $inx"]
>  }
> }
>

-- 
Dr. Axel Kohlmeyer
akohlmey_at_gmail.com  http://goo.gl/1wk0
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.