From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Thu Jun 04 2009 - 17:05:10 CDT

hi everybody,

since many VMD users are sometimes struggling to find memory leaks
due to improper use of the atomselect command, i've thinking about
finding ways to aid us in locating the offending code.

the attached tcl script code would be a first attempt to do this
in a way somewhat similar to the strace/ltrace or valgrind tools.

to use it, you need to evaluate the script by running
"play debug_atomselect.tcl" from the vmd console. and
then you have a new command: debug_atomselect.
this takes on argument that controls the tracing:

   on : enable tracing of atom selections
   off : disable tracing of atom selections
   verbose : verbosely report atomselect operations
   silent : don't report atomselect operations
   stats : print statistics (active/added/deleted)
   help : print this message

to explain. after you run "debug_atomselect on" all
newly created atom selections will be "wrapped" and
creating and deleting selections will be counted.
"debug_atomselect stats" will print these statistics
at any time. with "debug_atomselect verbose" all
calls to the created selections will be echoed.
"debug_atomselect off" will undo the "wrapping"
and these selections will then be no longer monitored.

i would be _very_ interested in getting feedback on this,
particularly, if you find this useful, and whether you
have suggestions for improvements and if this should
be included into the VMD distribution and automatically
read at startup (enabled in silent mode? or disabled?).

so _please_ try it out and let me know.

thanks,
   axel.

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.