MathGroup Archive 2001

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

Search the Archive

Re: Memory leak

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27894] Re: Memory leak
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 23 Mar 2001 04:31:13 -0500 (EST)
  • References: <99ci2g$8fp@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Carl:
With Mathematica 4.1 on Widows 98:

Print[{MemoryInUse[],MaxMemoryUsed[]}];
Do[Drop[{{1,2},{3,4}},-1,1];
  Print[{MemoryInUse[],MaxMemoryUsed[]}],{10}]

{1993256, 2086240}
{1993944, 2086240}
{1993976, 2086240}
{1994008, 2086240}
{1994040, 2086240}
{1994072, 2086240}
{1994104, 2086240}
{1994136, 2086240}
{1994168, 2086240}
{1994200, 2086240}
{1994232, 2086240}

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Carl K. Woll" <carlw at u.washington.edu> wrote in message
news:99ci2g$8fp at smc.vnet.net...
>
> Hi all,
>
> I have recently come across the following command which leaks memory,
> and thought that it might be of interest to the Mathematica community.
> To check for memory leaks in a statement, I run the following commands:
>
> Print[{MemoryInUse[],MaxMemoryUsed[]}];
> Do[ statement;
>     Print[{MemoryInUse[],MaxMemoryUsed[]}], {10}]
>
> If statement has no memory leak, then each of the print statements above
> should be the same (except for the first couple). For a simple statement
> like 1+1 this is indeed the case. However, when using the Drop command
> with more than one sequence specified, each of the print statements
> increases by 32 bytes on my system, which is Mathematica 4.0 on Windows
> NT. For example,
>
> Print[{MemoryInUse[],MaxMemoryUsed[]}];
> Do[ Drop[{{1,2},{3,4}},-1,1];
>     Print[{MemoryInUse[],MaxMemoryUsed[]}], {10}]
>
> will demonstrate this memory leak. If only one sequence specification is
> given, like Drop[{{1,2},{3,4}},-1] then no memory leak occurs. Feel free
> to comment on whether this is an accurate gauge of a memory leak, and
> whether your system also experiences this leak.
>
> Carl Woll
> Physics Dept
> U of Washington
>




  • Prev by Date: Re: How to find the equidistance curves of a curve defined by Interpolation function?
  • Next by Date: RE: Cylidrical Coordinates Plot
  • Previous by thread: Re: Memory leak
  • Next by thread: RE: Memory leak