Group Abstract Group Abstract

Message Boards Message Boards

1
|
11.7K Views
|
5 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How can I clear the history in a session?

Posted 5 years ago

Hello everyone,

I'm running a lot of loops on big data sets and need to conserve as much memory as possible. Each big loop creates a big file or results. I have set

$HistoryLength = 1;

but am wondering whether there is a way to clear all history of previous computations between runs of a loop without clearing variable definitions. Any tips?

Greg

POSTED BY: Gregory Lypny
5 Replies
Posted 4 years ago

This answer on MSE has a function for identifying which symbols are consuming memory greater than some specified size. I have found it useful for identifying symbols that consume a lot of memory which I can clear when they are no longer needed.

POSTED BY: Rohit Namjoshi
POSTED BY: Jules Manson
Posted 5 years ago

Oh... That makes sense. And thank you for sharing what you've learned.

POSTED BY: Mike Besso
Posted 5 years ago

Hi Mike,

Thank you for replying to my question.

I make regular use of Block, With, and Module. The slowdowns in processing many big files have to do with Mathematica accumulating a history of past computations. This happens even with Block or other scoping mechanisms if they contain loops.

A Wolfram tech support rep suggested that I throw in ClearSystemCache[ ], and that has resulted in a marked improvement in speed.

Greg

POSTED BY: Gregory Lypny
Posted 5 years ago

Greg:

I'm not yet a Wolfram Language expert, but if the Wolfram Language works like other languages that I've used, then you should might be able to use Block, With, and Module to scope your variables that require lots of memory.

This post might help.

POSTED BY: Mike Besso
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard