Have you tried setting
$HistoryLength to zero:
The memory is not freed, because the previous data is still available by
Note that if you do this, using
%n etc., which some people use in example code will not work. And when a large data set is shown the "Show More" and "Show Less" buttons do not work. You can bypass both problems by setting
$HistoryLength to 1 while still conserving a lot of memory.