MathGroup Archive 2013

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

Search the Archive

Simple program leaking memory - why?

  • To: mathgroup at
  • Subject: [mg130732] Simple program leaking memory - why?
  • From: gredner at
  • Date: Tue, 7 May 2013 03:55:08 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

Hi folks,

I'm fighting an issue in which a simple Mathematica program to export a bunch of plots is leaking a huge amount of memory - enough to exhaust the 12G available on my machine.  The problem is, it looks like the program should run in bounded memory!  A simplified version of my code which demonstrates the problem follows:

n = 10000;
(* just some bogus data *)
makeData[_] := Table[{{x, y} = RandomReal[{-3, 3}, {2}], {y, -x}}, {200}];
data = Array[makeData, n];
    "movie-" <> IntegerString[#, 10, 4] <> ".png",
    ListVectorPlot[data[[#]]]] &,
  Range[1, n]];

The problem occurs whether the loop is Map or Do, Parallel- or not.  It occurs in Mathematica 8 and 9, both under Linux.

The amount of memory leaked per frame is considerable - approximately .6 MB in my tests.  I don't see where it could be going, unless Export is caching every byte which passes through it!

I've also asked this question on stackexchange [1] but so far nobody has a clue.



  • Prev by Date: Remote kernel fails to launch
  • Next by Date: Re: very basic RecurrenceTable puzzle
  • Previous by thread: Remote kernel fails to launch
  • Next by thread: Re: Simple program leaking memory - why?