lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Burgess wrote:
> From: "Edgar Toernig" <froese@gmx.de>
> > David Burgess wrote:
> > >
> > > while (1) do
> > >   row = CUR:Fetch()
> > >   if not row then
> > >      break;
> > >   end
> > > -- CUR is garbage collected before next fetch
> > > -- during dostuff()
> > >   dostuff();
> > > end
> >
> > Unless dostuff overwrites CUR the GC will not collect it.
> > The GC will only collect unreachable items.  And the object
> > stored in CUR is definitely reachable...
>
> I would expect the same. It is not what I observe.
> My frustration soars (in case you have not picked
> up on this already).
> 
> dostuff() simply prints the row members.

Then insert some debug prints into your program.  I.e:

 while (1) do
   print(CUR)
   row = CUR:Fetch()
   if not row then
   ...

and a similar printf in the GC-routine to see whether the GC
really collects an item still stored in a global.  I doubt it...

Ciao, ET.

PS: You are aware that your examples are using global variables?
I see no local statement...