MathGroup Archive 2006

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

Search the Archive

Re: Optimizing memory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64883] Re: [mg64839] Optimizing memory
  • From: "Christopher Arthur" <pannoniara at aol.com>
  • Date: Mon, 6 Mar 2006 05:01:48 -0500 (EST)
  • References: <200603050818.DAA09741@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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 mac.com>
To: mathgroup at smc.vnet.net
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 mac.com>
>
> 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