0
$\begingroup$

Dear Mathematica users,

I have a running code in Mathematica which has a following general structure:

eval[initList_] := Block[{temp, i},

  temp = initList;

  For[i = 1, i <= 10^10, i++,

   $HistoryLength = 0;


   temp = f[temp];

   Export[StringJoin["output", "_", ToString[i], ".h5"], 
    temp, {"Datasets", {"temp"}}];];]

In which "f" is an operation updates "temp" at each step and it was defined using "Block". When I check the memory used by mathematica by running "top" in the terminal (Mac/Ubuntu) I see that while the memory used by WolframKernel is almost fixed in time the memory used by Mathematica is increasing until the RAM will be fully used and the computer crashes.

I was wondering if there is anyway to clear memory used by Mathematica during the running code?

p.s. When I stop the run and Quit the Kernel the amount of memory used by WolframKernel will be zero (I can see in the terminal) while the memory used by Mathematica is still the latest value!

$\endgroup$
  • $\begingroup$ Did you do any front-end related operation in your program, like opening of the databases through the gui-master or anything else like plotting? $\endgroup$ – Rom38 Aug 31 '17 at 8:41
  • 1
    $\begingroup$ Can you give a short self-contained example that illustrates the problem? $\endgroup$ – Szabolcs Aug 31 '17 at 8:49
  • $\begingroup$ You should also give detailed information about the Mathematica version you use and the OS (is that Ubuntu on a Mac?). It superficially looks like it could be a memory leak in the HDF5 export, and that could well be version/OS dependent... $\endgroup$ – Albert Retey Aug 31 '17 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.