MathGroup Archive 2005

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

Search the Archive

Re: Reducing memory footprint in use of FullSimplify ?

  • To: mathgroup at
  • Subject: [mg56195] Re: Reducing memory footprint in use of FullSimplify ?
  • From: dh <dh at>
  • Date: Tue, 19 Apr 2005 04:54:51 -0400 (EDT)
  • References: <4261f768$0$79461$> <1Dv8e.2568$> <d3vmum$jlr$>
  • Sender: owner-wri-mathgroup at

here is a small experiment, that may shed some light of the "memory" 
behaviour. It could be that the memory is used up by some internal variable.
Open the Task Mamager and observe the memory used by MathKernel.exe.
a = Table[0., {10^6}];
each time you execute above statement, the memory increases by about 
8MB. As you use always the same variable, the memory is NOT consumed by 
the user variable. Where does it go?
Even if you terminate your statement with ";" in order to prevent 
printing, the output is nevertheless stored in Out where it can be 
retreived by Out[number] or %number. We now clear Out by:
Watch the memory, it dropped.
Sincerely, Daniel

Madhusudan Singh wrote:
> Richard Fateman wrote:
>>You may have found a bug in Mathematica where it
>>is not reclaiming memory.  Perhaps you can write your
>>intermediate expressions to files before the system
>>crashes, and then re-load only the parts you need.
> Ok. Somehow I am not surprised. I moved from Mathematica 4.1 to 5.1 a few
> days ago. And the frontend has been a little flaky, crashing every now and
> then. Which has forced me to use the kernel alone (without the X frontend).
> Is there a command that can make Mathematica flush memory that is lost
> otherwise ?
>>It is probably a mistake to use FullSimplify for a lot
>>of expressions, since that program can be very costly, and
>>it is possible that it is, all by itself, on the last command,
>>using too much memory.
> No. I am using MemoryInUse[] to monitor the usage of memory after every
> FullSimplify operation is over. This increases almost monotonically even
> though the variable that it operates on is explicitly set to zero
> (replacing a very long expression - something that should free up large
> amounts of memory).
> Let us say I have 
> a=FullSimplify[b]
> where b is a very long complicated expression and a is a less complicated
> expression. Then the following operation :
> b=0;
> Print[MemoryInUse[]];
> after the FullSimplify above, should free up memory(b)-memory(a)+1 (assuming
> storing a zero takes one unit of memory) units of memory. However, I find
> that the above number is negative (if MemoryInUse[] is to be believed) even
> though it is pretty obvious that memory(b) > memory(a).
> As you say, that memory should be freed up as soon as it is done. One more
> wierd symptom I have noticed with version 5.1 is that if I interrupt a
> running Mathematica kernel (quit kernel), an orphaned process named
> aaa****** keeps running until I kill that separately using its PID.
> I wonder what people at Wolfram have been upto.
>>>Is there some way I can force Mathematica to free up memory on the data
>>>stack (I am currently setting the unsimplified expression to zero as soon
>>>as it is simplified and assigned to another variable) when it is done
>>>with an element ?
>>What do you mean by data stack?
> Well, I was referring to the size of data in KB that I am allowed (ulimit).
>>I assume you are setting expressions assigned to
>>Out[] to zero,  or clearing them.
> I am using $HistoryLength=0. Would that be equivalent ?

  • Prev by Date: Re: Integrate is driving me crazy, please help!
  • Next by Date: Re: Bug in UI?
  • Previous by thread: Re: Reducing memory footprint in use of FullSimplify ?
  • Next by thread: match 1, replace 2