[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Creating closures (or not)
- From: Daniel Silverstone <dsilvers@...>
- Date: Tue, 13 Jul 2010 13:08:03 +0100
On Tue, Jul 13, 2010 at 09:04:35AM -0300, Roberto Ierusalimschy wrote:
> > My guess is that they would only be pooled if they share the same prototype,
> > and do not use any upvalues, such as:
> >
> > t = {}
> > for i = 1, 10 do
> > t[i] = function() end
> > end
>
> They may be reused even with upvalues, as long as they have the same
> upvalues; each prototype caches the last closure created with it.
Presumably this cache is weak? Otherwise you could create a really nasty GC
leak.
D.
--
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 3CCE BABE 206C 3B69
- References:
- Creating closures (or not), Geoff Leyland
- Re: Creating closures (or not), Peter Cawley
- Re: Creating closures (or not), Geoff Leyland
- Re: Creating closures (or not), Javier Guerra Giraldez
- Re: Creating closures (or not), Geoff Leyland
- Re: Creating closures (or not), Pierre-Yves Gérardy
- Re: Creating closures (or not), Roberto Ierusalimschy
- Re: Creating closures (or not), Duncan Cross
- Re: Creating closures (or not), Kristofer Karlsson
- Re: Creating closures (or not), Roberto Ierusalimschy