MathGroup Archive 1999

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

Search the Archive

Memory bloat -- what have I done?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19219] Memory bloat -- what have I done?
  • From: "Aram Schiffman" <aram at sirius.com>
  • Date: Tue, 10 Aug 1999 02:53:05 -0400
  • Organization: Posted via Supernews, http://www.supernews.com
  • Sender: owner-wri-mathgroup at wolfram.com

Hi. Help?

I have this:

outOfHoleIndex = {};

If[MemberQ[inHoleIndex, #] === False, AppendTo[outOfHoleIndex, #],] & /@
nums;


inHoleIndex is an array of reals, inHoleIndex//Length is about 8000 or so.
Nums is just the counting numbers {1,2,3,...11875}.

I check MemoryInUse[] before and after, and get -- a difference of about 158
megabytes! Huge! What the hell am I doing wrong? If I do

Unprotect[Out]; Clear[Out]; Protect[Out];

Then I get most of that memory back. Also, if I rig the code so that MemberQ
is always True (i.e., never AppendTo outOfHoleIndex), this big chunk of
memory never gets moved. I guess I don't understand how AppendTo contributes
to Out, here, and more importantly, how to write my code correctly.

Anyone?

Thanks,
Aram





  • Prev by Date: Re: Equation Font
  • Next by Date: Re: Sort
  • Previous by thread: Re: Precision Problems
  • Next by thread: Re: Memory bloat -- what have I done?