This question is inspired by the question on memory leaks in Mathematica due to internal caching of results of intermediate computations. All these things are undocumented but are important for anyone who runs memory-intensive computations.
When trying to understand the logic of the internal caching mechanism I found something interesting. Consider the following:
$HistoryLength = 0;
(*dummy command for loading of the Root package*)
Root[# &, 1];
d = 13;
f[z_, i_] := Sum[(2 Mod[Floor[(i - 1)/2^k], 2] - 1) z^(d - k), {k, 0, d}];
(memLog = Flatten[
Table[Root[f[z, i], j]; {SessionTime[], MemoryInUse[]/1024.^2}, {j, 1,
d}, {i, 1, 2^d}], 1];) // Timing
pl1 = ListLinePlot[memLog,
FrameLabel -> {"SessionTime, sec", "MemoryInUse, Mb"}, PlotRange -> All,
Frame -> True, Axes -> False]
pl2 = ListLinePlot[memLog[[All, 2]],
FrameLabel -> {"Point", "MemoryInUse, Mb"}, PlotRange -> All, Frame -> True,
Axes -> False]
In fresh kernel session the output on my machine (Mathematica 7.0.1 for Windows) is always as follows:
Can anyone explain why there is a break of the curve near the point number 8400?