I have a code that works over lists like
S0; (*initial list*)
S1=f[S0];
S2=g[S1];
S3=f[S2];
S4=f[S3];
.
.
.
where f
and g
are functions that produces larger lists that consume a large amount of RAM memory. I thought that running
S0; (*initial list*)
S1=f[S0]; Clear[S0];
S2=g[S1]; Clear[S1];
S3=f[S2]; Clear[S2];
S4=f[S3]; Clear[S3];
.
.
.
would free the memory used from the kernel, but it is not the case. The consumption of both codes are exactly the same. I stored (using Save
) the result for S10, for example, and after Get
it (with a clear kernel) the memory consumption is much less than running the code, even using Clear
in each step as above.
Is there a stronger version of Clear
which eliminates the information of a symbol from the kernel? Or does Clear
do it, but the task manager keeps showing the same memory usage from before?
$HistoryLength
-- change it to something much less than the default. $\endgroup$$HistoryLength
later? Like, if I aim to getS10
and then make other operations using it and other things, can I redefine to infinity after the computation ofS10
? $\endgroup$