Message Boards Message Boards

Avoid memory usage to be inexplicably high?


Hello. I have written a code in Mathematica which creates as a result an array with 19280 arrays, each with 4 elements. The first three being numbers and the fourth being another array with 914 elements. It works, and the final array is stored in a .dat file 206.8 MB in size. The program says the maximum memory used should be approximately 3.2GB (using the command MaxMemoryUsed[]). However, when running the program, the used memory in the system goes up approximately 15GB. Also, after the program has finished and the notebook is closed, this memory usage remains. It is only after quitting the Kernel manually that the memory usage goes back to normal. The $HistoryLength is set to zero. The file is created by reading and writing it in the following Do loop:

 datos = Evalvecmin[\[Mu]120, \[Mu]23i, \[Mu]23f, \[Mu]23step];
 tmp = << "datos_Na2M25par_sepfino5.dat";
 eminvecminq = Union[tmp, datos];
 eminvecminq >> "datos_Na2M25par_sepfino5.dat" , {\[Mu]120, \[Mu]12i, \[Mu]12f, \[Mu]12step}]

And it’s in this step that the memory usage starts increasing way more than it should. Why is the memory usage going up so much? Thank you, Juan José

8 days ago

Group Abstract Group Abstract