From: Axel Kohlmeyer (
Date: Tue Dec 02 2008 - 12:58:25 CST

On 12/2/08, Ondrej Marsalek <> wrote:
> axel,
> thanks again, now it seems that i have really encountered what you
> described. for reference, my system is ubuntu 8.10 64-bit. vmd was
> compiled using g++. i do have intel compilers as well, but did not set
> the ICC flag in vmd configuration, so i hope i really got g++.
> i still don't understand why it happens only with some data, but i am
> not sure i want to understand that. often (in my intended use always)

the malloc has some heuristics on when to allocate how much memory
where. larger chunks come from mmap() and can be given back to the
OS, smaller not. as i wrote before, you can try using a different malloc
library or check the use of environment variables that allow to tune
the behavior of the gnu malloc.

> vmd (or rather the memory system) does not free any memory after
> deleting molecules. this memory gets "recycled" for further data
> loaded into vmd, so the total memory footprint of vmd is the maximum
> use of the given run.
> while i agree that this is strictly speaking not a memory leak and
> probably not caused by vmd code, it is still something i would like
> to get rid of. vmd is not the only thing running on my system :-) i am
> not sure it is worth playing with my system libraries, though. any
> other options?

all of what malloc does is on the application level, so there is no need
to change the system libraries, you can easily link to libraries installed
somewhere in your home or in the vmd tree. all you have to do is to add
the flags them to the proper places in vmd's configure script.

allocated memory pages that are not touched will be quickly moved
into swap, so your machine will stay usable (provided you have enough
swap configured). that usually works very well and the linux memory
management is tuned to these kind of scenarios. since the speed difference
between disk i/o and memory bandwidth is so incredibly large these days,
there is not other real use for swap anyways.


> regards,
> ondrej

Axel Kohlmeyer
  Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.