Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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. – R. M. May 30 '12 at 4:15
Ok, it gets faster at some point. Now it's at 250 MB after 1 hr. 8.04 on MacOSX. – R. M. May 30 '12 at 5:16
Confirmed on version 7 under Windows 7. It is significantly worse with Animator[Dynamic@α, RefreshRate -> 120] – Mr.Wizard May 30 '12 at 5:30
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). – Sjoerd C. de Vries May 30 '12 at 10:43
This looks like a multi-platform/multi-version bug indeed. Could you report this to – 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?

share|improve this answer
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. – Mr.Wizard May 30 '12 at 17:50
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. – Mr.Wizard May 30 '12 at 17:53
up vote 3 down vote accepted

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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