Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I was trying to say something useful here

Debugging memory leaks

but I got very confused. Can somebody please confirm that the following will cause a big gap between the allocated memory you start with and the allocated memory you end up with?

First select and evaluate a cell containing

$HistoryLength = 1; {Prepend[Range[5000000], {0}], 1};

(-> 30863968 -> 150855648 on my system)

And then select and evaluate a cell containing

($HistoryLength = 0; Unprotect[In, Out]; Clear[In, Out];);

(-> 77329280 on my system)

Note that if I select both cells at the same time and evaluate them both with one shift-enter, this does not happen on my system.


My version is "9.0 for Mac OS X x86 (64-bit) (November 20, 2012)"

A comment revealed that "the memory consumption is tied to cell references".

Can somebody maybe explain this behavior?


share|improve this question

closed as off-topic by Jacob Akkerboom, Michael E2, Yves Klett, bobthechemist, rasher Mar 14 at 23:02

  • The question does not concern the technical computing software Mathematica by Wolfram Research. Please see the help center to find out about the topics that can be asked here.
If this question can be reworded to fit the rules in the help center, please edit the question.

right. This is correct behavior. The memory consumption is tied to the cell references. –  Andreas Lauschke Mar 16 '13 at 20:42
This does not happen here. Memory correctly goes back to the starting point after running the second cell. MMA v9.0.1, windows. So you probably should state your version –  Rojo Mar 16 '13 at 20:56
Doesn't happen with V9.0.1 on OS X. Memory goes back to starting point as @Rojo says. –  m_goldberg Mar 16 '13 at 22:14
@AndreasLauschke maybe you could elaborate? The two comments above by Rojo and m_goldberg seem disagree with your statement. –  Jacob Akkerboom Mar 16 '13 at 22:56
This question appears to be off-topic because it is too localised in time and it is not interesting anymore. It is unlikely that there will be a better answer than what has already been posted in the comments. –  Jacob Akkerboom Mar 14 at 15:39
show 1 more comment

Browse other questions tagged or ask your own question.