Re: Garbage collection and mutable data structures
- To: mathgroup at smc.vnet.net
- Subject: [mg85645] Re: Garbage collection and mutable data structures
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sun, 17 Feb 2008 07:19:20 -0500 (EST)
- References: <fp67h9$5f6$1@smc.vnet.net>
Hi,
try
Information /@ Names["c$*"]
and find out where the reference to c$* is keept.
Regards
Jens
massyah at gmail.com wrote:
> 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.
>