VMD-L Mailing List
From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Aug 14 2007 - 12:14:38 CDT
- Next message: Audrey Salazar: "Re: Installing VMD to work with MSMS"
- Previous message: John Stone: "Re: Installing VMD to work with MSMS"
- In reply to: Philipp Schön: "Increasing use of RAM even if I put unset/delete for selections! Due to use of arrays?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Hi,
In a quick read, it appears to me that you have doubly nested loops
setting the bin() array with the results of atom selections, without
any intervening calls to $bin(...) delete. When you overwrite the contents
of an element $bin() with a new value, the old atom selection is not freed,
and thus the memory will continue to be used. You can verify that you
are leaking atom selections using the command:
atomselect list
If you have a large list of atom selections at the point when
you exit your doubly nested loops, that indicates that you are
indeed failing to delete the selections properly within the loop.
This is the most likely problem you're having from what I saw in a quick read,
assuming I didn't make any mistakes myself while reading...
Cheers,
John Stone
vmd_at_ks.uiuc.edu
On Tue, Aug 14, 2007 at 12:28:13PM +0200, Philipp Schön wrote:
> dear users,
> this is a small fraction of my code where i look for some atoms in a bin to get the indices and from that i got all atoms for use in a second step.
> i do it by using arrays as ictmp($k) [INTEGER], bin($k) [ATOMSELECT], atmbin($k) [ATOMSELECT] and some more.
> after i did all this i delete selected atoms and unset variables. however, the program still uses more and more RAM during run-time.
> are there some special features to consider when using arrays?
> Any help is appreciated since i need to post-process rather huge files.
> cheers
> philipp
>
> for {set k 1 } { $k < $kcloop } {incr k } {
> set SB($k) 0.0
> }
> # ENTER MAIN LOOP HERE!
> for {set i 0 } { $i < $nf } {incr i } {
> set zbin(0) $z0
> for {set k 1 } { $k < $kcloop } {incr k } {
> set ictmp($k) 0
> set ic($k) 0
> set zbin($k) [expr $z0 + [expr $k * $binheight]]
> set m [expr $k - 1]
> set zlowerbound $zbin($m)
> set zupperbound $zbin($k)
> set bin($k) [atomselect $mol0 "water and same residue as $zlowerbound <= z and z < $zupperbound"]
> $bin($k) frame $i
> $bin($k) update
> set binlist($k) [$bin($k) get index]
> set ictmp($k) [llength $binlist($k)]
> if {$ictmp($k)!= 0} {
> set atmbin($k) [atomselect $mol1 "index $binlist($k)"]
> $atmbin($k) frame $i
> $atmbin($k) update
> }
> }
> ... DO SOMETHING HERE
>
> for {set k 1 } { $k < $kcloop } {incr k } {
> # clean up selections before re-entering the loop
> # and empty RAM if work is done
> $atmbin($k) delete
> $bin($k) delete
> unset binlist($k)
> unset sum($k)
> unset tmp($k)
> unset ictmp($k)
> unset m
> # finish calculation of averaged quantity SB
> }
> unset zupperbound
> unset zlowerbound
> # finish k-loop (spatial bins)
> }
> # finish i-loop (time frames)
> }
>
> _____________________________________________________________________
> Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
>
-- NIH Resource for Macromolecular Modeling and Bioinformatics Beckman Institute for Advanced Science and Technology University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801 Email: johns_at_ks.uiuc.edu Phone: 217-244-3349 WWW: http://www.ks.uiuc.edu/~johns/ Fax: 217-244-6078
- Next message: Audrey Salazar: "Re: Installing VMD to work with MSMS"
- Previous message: John Stone: "Re: Installing VMD to work with MSMS"
- In reply to: Philipp Schön: "Increasing use of RAM even if I put unset/delete for selections! Due to use of arrays?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]