# Flushing RAM in Mathematica

1. Feb 13, 2012

### Curl

I'm trying to plot some 3D functions in mathematica, but each time I evaluate the cell, more and more RAM gets eaten up.

How do I clear the memory to keep this resonable? My PC almost crashed because I ate up all the memory. I tried ClearAll and ClearSystemCache[] and it didn't work.

I'm new with Mathematica. Also Im using version 8

thanks

2. Feb 13, 2012

### Greg Bernhardt

Buy some more RAM, it's very cheap!

3. Feb 14, 2012

### Bill Simpson

Try setting $HistoryLength to a modest value if you absolutely have to. http://reference.wolfram.com/mathematica/ref/$HistoryLength.html

And as Greg said, having more memory than anyone tells you is reasonable will serve you well with Mathematica. 16Gig might be a reasonable amount today, only because we still don't see many boards that will accept 32 or 64 yet.

Set your swap space to be about the same amount as your memory and when Mathematica starts hammering the drive with swapping that is a clue you need to start paying attention to the calculation sizes.

Using memory is a good thing, not a bad thing, if memory isn't mostly committed to a task it is serving no purpose. Aim for perhaps 75% being used by Mathematica and peak at 180% with swapping.

If the machine is going to crash with that then figure out what is wrong with the machine and fix that.