MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Memory leak bug in plotting functions? (Sudden kernel shutdown without error message)

Hello mathgroup,

I have an iterative data analysis routine that prints complex plots
into the notebook, so that I can come back and audit the intermediate
data analysis steps post-hoc. I have recently encountered a problem in
v6.0 (Win32) where the kernel suddenly quits on me, without any error
message. This happens after a relatively predictable number of
iterations of my analysis routine.

I have isolated the putative memory leak into the following
proof-of-principle code.

 Print[{MemoryInUse[], MaxMemoryUsed[]}];
 Print[  Plot[Sin[x]*Random[Real, {0.9, 1.1}] + Random[Real, {0,
Pi/5}], {x, 0, 2 Pi},ImageSize -> 72*1]   ],

As this iteration runs, the MaxMemoryUsed[] value creeps up gradually.
In my real code, the MaxMemoryUsed[] reaches a certain threshold, and
the kernel predictably fails (silently) at that point. I have tried
various methods such as ClearSystemCache[], Share[] and NotebookSave[]
to no avail. It is always the kernel that quits, not the front end or
java. I don't think it is the output using up too much memory in the
front end, since if I restart the kernel and resume the calculation
from where it quit, I can go for another while, even though the
previous output is all still in the notebook frontend.

It is interesting that I don't seem to get this problem when I plot a
simple function, like Sin[x]. The problem segment of my actual code is
a large LogListPlot of a large amount of complex data, so I guess it's
not directly related to the Plot[] interpolation, etc. (In my real
code, I Rasterize[] to low resolution, to save memory on the front

Thank you in advance for your help.


  • Prev by Date: Re: Need features to make kernel and user functions bullet proof
  • Next by Date: Precedence of Infix Operator
  • Previous by thread: line in 3d in direction of eigen vector
  • Next by thread: Precedence of Infix Operator