Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2007

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

Search the Archive

Re: memory release problem in mathematica6.0

  • To: mathgroup at
  • Subject: [mg83340] Re: memory release problem in mathematica6.0
  • From: m.r at
  • Date: Sat, 17 Nov 2007 05:38:09 -0500 (EST)
  • References: <fhegac$m08$> <fhh71o$8h2$>

It's hard to tell without seeing a specific example, but sometimes you
need to make sure that the structure really was deallocated.

In 6.0.1 under XP, if I monitor the memory usage with Task Manager or
from Mathematica using

     "!tasklist /fi \"imagename eq math*\" /fo csv",
     "CSV"] // Rest // Grid // Panel,
 SynchronousUpdating -> False, UpdateInterval -> 1]

and then evaluate

In[2]:= A = Range[25*^6];
In[3]:= Clear[A]
In[4]:= Timing[A = Range[25*^6];]
In[5]:= Clear[A]

the memory usage doesn't drop after the first Clear[A] because A is
still stored in Out[2], but it drops after the second Clear[A].

Maxim Rytin
m.r at

On Nov 16, 4:17 am, jack <giaber... at> wrote:
> What i was pointing out ( there is a typo error in my post ) is that
> the MemoryInUse[] command of mathematica gives the correct result in
> the sense that memory is released but the physical memory not yet. I
> understand that memory management of mathematica is different from
> that of the Operating System for speed reasons, but i think that
> something goes wrong because, as is confirmed by Yaroslav Bulatov in a
> successive post, when i clear a symbol ( of many elements, ~300MB )
> and a reallocate it three or four times physical memory runs out and
> the memory system swaps all the time  ( i' ve 756MB of RAM ) until i
> shutdown the kernel.
> I' d like to know if there is an explicit way to synchronize the
> memory management of mathematica with that of the OS, because i think
> that the behavior that i' ve just described must be avoided.
> Thanks for your contribute.
> Jens-Peer Kuska wrote:
> > Hi,
> > you think that Mathematica call the memory management functions
> > of the operating system every time it aqquire or release memory ?
> > This would probably incredible slow .. it will request memory from the
> > operating system and integrate it inti its own memory management
> > And the operating system show it't own memory management but not that
> > of Mathematica ..
> > Regards
> >    Jens
> > jack wrote:
> > > Hi all,
> > > When i define large data structures, for example an array  "A" of
> > > million  of elements that occupy some  hundreds of MB of physical
> > > memory,when i clear it, with Clear[A] memory isn' t released by
> > > operating system. I' ve tried both on windows and linux.
> > > The result of MemoryInUse[] command of mathematica but the physical
> > > memory reported by the system monitor isn't released.
> > > I' ve tried also ClearSystemCache[] but with no result.
> > > Am i missing something?
> > > Thanks!

  • Prev by Date: Re: BinaryWrite and Position in Mathematica 6
  • Next by Date: Re: Piecewise inside a Module or Block, I don't understand this behavior.
  • Previous by thread: Re: memory release problem in mathematica6.0
  • Next by thread: Re: memory release problem in mathematica6.0