A very abridged example of what was originally a major leak

{Animator[Dynamic@α, RefreshRate -> 120],
 Dynamic[arrows = (α; Arrow[{{0, 0}, {0., 1} + 0.001 RandomReal[2, 2]}]);],
 Dynamic[Graphics[arrows, ImageSize -> Tiny]

I'm running Windows 7, x64, Mathematica 8.0.4. The Mathematica.exe process slowly (in this example) grows in memory usage and nothing I tried other than close and reopen Mathematica, seems to help.

Can you reproduce the problem? Is it known? What exactly is causing it? Any way to handle it?

I haven't got much experience in interfaces, but I had done a satisfactory one only to realise after a while it was using up 1.5GB of RAM

  • $\begingroup$ How fast is the memory leaking on your machine for this example? I see something like 0.5 MB increase in memory/10 mins of running. $\endgroup$ – rm -rf May 30 '12 at 4:15
  • $\begingroup$ Ok, it gets faster at some point. Now it's at 250 MB after 1 hr. 8.04 on MacOSX. $\endgroup$ – rm -rf May 30 '12 at 5:16
  • $\begingroup$ Confirmed on version 7 under Windows 7. It is significantly worse with Animator[Dynamic@α, RefreshRate -> 120] $\endgroup$ – Mr.Wizard May 30 '12 at 5:30
  • $\begingroup$ Confirmed here too. Windows7-64, MMA 8.04. There's indeed a speed-up after some time. I'd say I lose about 1 MB/s (using Mr.Wizard's setting). $\endgroup$ – Sjoerd C. de Vries May 30 '12 at 10:43
  • $\begingroup$ This looks like a multi-platform/multi-version bug indeed. Could you report this to support@wolfram.com? $\endgroup$ – Sjoerd C. de Vries May 30 '12 at 10:48

It seems like it's the Graphics[arrows] part. This:

{Animator[Dynamic@\[Alpha], RefreshRate -> 120], 
 Dynamic[arrows = (\[Alpha]; 
     Arrow[{{0, 0}, {0., 1} + 0.001 RandomReal[2, 2]}]);], 

Does not produce a memory leak for me: MMA 8.0.0 on Win7-64. Is it possible it is a history / Out[] type problem?

| improve this answer | |
  • $\begingroup$ I still get a memory leak with this but it's a slow one. I suppose it's related to this one where each unique object created is cached somehow. $\endgroup$ – Mr.Wizard May 30 '12 at 17:50
  • $\begingroup$ I even get a slow leak with {Animator[Dynamic@\[Alpha], RefreshRate -> 120], Dynamic[arrows = (\[Alpha]; Arrow[{{0, 0}, {0., 1}}]);], Dynamic[Null]} so there is perhaps a separate leak even without unique objects. $\endgroup$ – Mr.Wizard May 30 '12 at 17:53

Reported, and forwarded to the developers. It is still there in v9

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.