5

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?

rm -rf
  • 88,781
  • 21
  • 293
  • 472
Lorenzo Pistone
  • 1,607
  • 11
  • 16

1 Answers1

4

Use

 $HistoryLength = k

to keep the last k lines of input and output.

kglr
  • 394,356
  • 18
  • 477
  • 896