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.
- Follow-Ups:
- Re: Garbage collection and mutable data structures
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Garbage collection and mutable data structures