5
$\begingroup$

This question already has an answer here:

While tinkering with a notebook that loads a large chunk of data in memory, I noticed that if I run it multiple times, the past chunks reside in memory. I understand that the reason (or one of) for which this happens is that the past output mechanism (%) keeps a reference to them, so they cannot be garbage collected.

Is there a way to explicitly make Mathematica forget some data?

$\endgroup$

marked as duplicate by Kuba Dec 10 '18 at 7:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

4
$\begingroup$

Use

 $HistoryLength = k

to keep the last k lines of input and output.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.