MathGroup Archive 2005

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

Search the Archive

Re: MemoryInUsediffers from System report

  • To: mathgroup at
  • Subject: [mg55109] Re: MemoryInUsediffers from System report
  • From: Bill Rowe <readnewsciv at>
  • Date: Sat, 12 Mar 2005 02:37:11 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 3/11/05 at 4:20 AM, chicong.v at (ChiCong) wrote:

>I think that I've found a bug about MemoryInUse[]. If I am wrong
>please tell me. Thank you in advance for your support!

>I am running Mathematica 5.1.1 for Linux x86 (64 bit)  (January 30,
>2005) on SuSE Linux 9.2. The CPU is AMD Opteron Processor 850.
>Kernel version is 2.6.5-7.139-smp.

>After a lot of heavy computation, Mathematica says that its memory
>usage is as follow:

>In[38]:= N[{MemoryInUse[],MaxMemoryUsed[]}/2^20] Out[38]:=
>{41.3403, 1047.04}

>However, using the top command shows that Mathematica is using
>about 3GB of memory. What's more is that Mathematica doesn't
>release the memory even when I try:

>Share[]; $HistoryLength=10; $RecursionLimit=100;

>Can you explain me how can Mathematica says that it is using only
>41.3403 MB, while in fact it is using about 3GB? And is there any

According to the documentation, MemoryInUse reports the number of bytes used for storage of *data* in the current session. This would not include memory used for the front end code or kernel. So, you should expect MemoryInUse to report a smaller number than top. But I do think the difference you are seeing is quite a bit larger than what should be expected.

In my case with MacOS X, I see


while top reports 17.32 MB, implying the front end, kernel etc use 12-13 MB. While I would not expect this difference to grow, there might be some other memory usage not reported by MemoryInUse that does grow and accounts for the difference you see.

And when you say Mathematica doesn't release memory when you use Share[] etc., I assume you are saying the number reported by top doesn't change. As I understand it using Share[] and setting $HistoryLength to a small number after a session has started only frees that memory to be used in Mathematica and does not release it back to the system. That is, I would expect the number reported by MemoryInUse to decrease when Share[] etc. is used but would not expect a decrease in the number reported by top.
To reply via email subtract one hundred and four

  • Prev by Date: Re: Ver 4.0 error, "There seems to be ..." corrupts opening a notebook
  • Next by Date: Re: Ver 4.0 error, "There seems to be ..." corrupts opening a notebook
  • Previous by thread: Wolfram Research Releases gridMathematica 2 and Parallel Computing Toolkit 2
  • Next by thread: How to use "Solve" to get only real number solutions?