MathGroup Archive 1999

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

Search the Archive

Memory bloat -- what have I done?


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?