12
$\begingroup$

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

$\endgroup$
6
  • $\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, 2012 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, 2012 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, 2012 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$ May 30, 2012 at 10:43
  • $\begingroup$ This looks like a multi-platform/multi-version bug indeed. Could you report this to [email protected]? $\endgroup$ May 30, 2012 at 10:48

2 Answers 2

4
$\begingroup$

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

$\endgroup$
3
$\begingroup$

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]}]);], 
 Dynamic[Graphics[arrows];]}

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?

$\endgroup$
2
  • $\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, 2012 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, 2012 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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