MathGroup Archive 2008

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

Search the Archive

Garbage collection and mutable data structures

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85638] Garbage collection and mutable data structures
  • From: massyah at gmail.com
  • Date: Sat, 16 Feb 2008 03:33:06 -0500 (EST)

Hi MathGroup,

This snippet of code is giving me headaches:

-----
$HistoryLength = 0;
NewCell[i_] := Module[{c}, CellVal[c] ^= i; c]
MemoryInUse[]
NewCell /@ Range[10^5];
MemoryInUse[]
-----

It occurred while trying to build mutable data structures by using
upvalues. I can't understand why the temporary variable c is not freed
since I don't keep any reference to it.
Have I missed something in the reference counting scheme ?


Thanks in advance,
Hayssam.


  • Prev by Date: Re: "Assuming"
  • Next by Date: Re: Part or Partition or Split or Extract or ...... ????
  • Previous by thread: Re: Pythonika - Difficulties to install
  • Next by thread: Re: Garbage collection and mutable data structures