lua-users home
lua-l archive

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


On Thu, 2004-10-28 at 09:40 -0700, George Warner wrote:
> His reply was:
> "... its actually better memory-wise to call the function four or
> more times than it is to store a temporary variable. This is due to LUA's
> memory management system."

Afaict, this is entirely bogus.

> Is this true? Do "local" variables have a life beyond their scope? Do they
> waste memory?

Only in the same way as ephemeral results from functions do :-)

> Inquiring minds want to know... Who's a stooge? ;-)

It's related to an old tv-show IIRC called 'The three stooges'

do
  local name = Get....

end
collectgarbage()

seems like the cleanest way to absolutely be sure the local variable
gets vaguely cleaned up; but of course in a garbage-collected system you
can't have that much control anyway.

D.

-- 
Daniel Silverstone                         http://www.digital-scurf.org/
PGP mail accepted and encouraged.            Key Id: 2BC8 4016 2068 7895