MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Optimizing memory

  • To: mathgroup at
  • Subject: [mg64883] Re: [mg64839] Optimizing memory
  • From: "Christopher Arthur" <pannoniara at>
  • Date: Mon, 6 Mar 2006 05:01:48 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

There is a function called "Share" for which the intention seems to be
garbage collection, but I have had mixed results using it.  Otherwise, you
can call Names["symbol*"] to get a list of all the defined symbols that
start with "symbol".  This will tell you what you want since local variables
are identified uniquely from one instance to another by a suffixed module
number; e.g. if your variable is called "myVariable", then when the module
runs it will get a name like "myVariable$2341"  where 2341 identifies the
unique instance.  If you call Names after your modules execute and you still
see a lot of dollar signs and numbers, then you may have a problem.

----- Original Message ----- 
From: "Sensei" <senseiwa at>
To: mathgroup at
Subject: [mg64883] [mg64839] Optimizing memory

> Hi!
> I wrote a parser for PDB files that calculates atom and residue
> inertia matrices, and I am sure I have written the worst code ever :)
> I'm new to Mathematica, so I don't think I know how to optimize my
> code. One particular concern is this.
> Using Module[] and defining many local symbols, is the memory
> associated to them deallocated when the call exits? Or is it possible
> to force memory deallocation?
> myParser[filename_]:=Module[
>    { (* many symbols *) },
>    symbol1 = ...;
>    symbol2 = ...;
>    (* very BIG memory allocation *)
>    ...
> ]
> Thanks for any information!
> --
> Sensei <senseiwa at>
> The optimist thinks this is the best of all possible worlds.
> The pessimist fears it is true.      [J. Robert Oppenheimer]

  • Prev by Date: Re: mathematica to word
  • Next by Date: Re: mathematica to word
  • Previous by thread: Optimizing memory
  • Next by thread: Re: Optimizing memory