Re: garbage collection with Unique and Temporary
- To: mathgroup at smc.vnet.net
- Subject: [mg69777] Re: garbage collection with Unique and Temporary
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sat, 23 Sep 2006 04:43:52 -0400 (EDT)
- References: <acbec1a40609212340t54f2838dpe4b944d6622748f0@mail.gmail.com>
I think the folowing might show the answer, which is, "Yes".
In[1]:=
vars={x[1],y[2]};
Module[{aliasList=Table[Unique[],{Length@vars}]},
SetAttributes[#,Temporary]&/@aliasList;Print[aliasList];1+z]
??$1
From In[1]:=
{$1,$2}
Out[2]=
1+z
Information::notfound:Symbol $1 not found.
On 9/22/06, Chris Chiasson <chris at chiasson.name> wrote:
> Imagine that, inside a Module, I manually create a variable using
> Unique and assign it the Temporary attribute. If the variable does not
> appear in any definitions when the module exits, will it be garbage
> collected via Remove? If not, what happens?
>
> --
> http://chris.chiasson.name/
>
--
http://chris.chiasson.name/