MathGroup Archive 2004

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

Search the Archive

Clearing local variables and Memory Leaks

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52219] Clearing local variables and Memory Leaks
  • From: "Alan" <info at optioncity.REMOVETHIS.net>
  • Date: Sun, 14 Nov 2004 20:15:26 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I had some long computations that
used more and more memory.
The advice from someone at WRI responding
to a similar problem in an old newsgroup post was to clear local
variables in Modules before leaving them.

I added a Clear statement
to each Module, just before my Return, where
I clear every local variable except the
one I am returning. Sure enough, this
solved my problem.

My questions: I am still puzzled as to
why it would be dangerous for this
behavior to be automatic? That is, once
Mathematica has calculated what will
be returned, what would go wrong if
it cleared every local variable just before
returning. If it's *not*
dangerous, is there some easy way to force it
to happen globally? 



  • Prev by Date: Re: Plot and axes
  • Next by Date: Re: Plot and axes
  • Previous by thread: Re: Re: copy and paste
  • Next by thread: [LinearAlgebra] Re: Matrix Dot Product