From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Sun Oct 17 2010 - 13:29:22 CDT

On Sat, Oct 16, 2010 at 9:11 PM, TRINH Minh Hieu <mhtrinh_at_gmail.com> wrote:
>
> Hi,

hi,

thanks for the concise report with a simple example to reproduce it.

> I think I found a memory leak with the command : mol modselect when using
> index (or serial)
> I'm currently using vmd-1.8.7
>
> To reproduce the bug :
> - Load a pdb file
> - In console, run :
>
> for {set i 0} {$i <= 5000} {incr i} {mol modselect 0 0 "index = 10"}
>
> - Each time the previous command is ran, the memory usage by vmd increase (I
> use "top" to see this)

confirmed! i ran this with valgrind and could also locate the origin
of the memory leak. the straightforward change to avoid this leak
is the following patch:

Index: ParseTree.C
===================================================================
RCS file: /vmd/cvsroot/vmd/src/ParseTree.C,v
retrieving revision 1.129
diff -u -r1.129 ParseTree.C
--- ParseTree.C 10 Nov 2009 22:21:24 -0000 1.129
+++ ParseTree.C 17 Oct 2010 18:25:07 -0000
@@ -595,6 +595,8 @@
     delete tmp;
     return NULL;
   } else {
+ // avoid memory leak.
+ if (int_table) free(int_table);
     // if there isn't a list, then I have something like
     // mass + 5 < 7
     // so just return the data

> Normally, I guess that nobody use that much the "mol modselect" command ...
> In my case, I'm making movie with vmd so I run a lot of "mol modselect"
> (almost one per frame)

how urgently do you need a corrected VMD binary?
and for which platform?

cheers,
      axel.

>
> Regards,
>
> --
> ============================================
>    M. TRINH Minh Hieu
>    CEA, IBEB, SBTN/LIRM,
>    Tél : 04 66 79 19 44
>    F-30207 Bagnols-sur-Cèze, FRANCE
> ============================================
>

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.