lua-users home
lua-l archive

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


.
On Mar 16, 2012 11:57 AM, "Roberto Ierusalimschy" <roberto@inf.puc-rio.br> wrote:
>
> > We used this for detecting in-Lua "leaks" in Prosody. I improved the
> > script and maintain it here:
> > http://code.matthewwild.co.uk/luatraverse/
>
> I would like to suggest the term "hoarding" (or "memory hoarding") for
> that kind of problem (so that we do not need the quotes around "leaks" :)..

I really like that--it explains very succinctly what is happening to a C programmer.

In two-word form, I would suggest "data hoarding". It's not that you are holding onto memory; there is no such thing as memory at the abstraction level this happens. It's that you're keeping data accessible which you'll never use again. 
After people say "how can there be 'leaks' in a language with automatic storage management?" there are two simple important examples.

The first is a logger function which appends messages to a table but never reads them. Whole-program analysis can demonstrate the contents of the log cannot affect the future of the program and are thus eligible for collection, but outside of closures this requires the program to be static. If you load a module for scanning the log, it will be surprised when it is empty (and you will be as well when you look at the log table in the debugger).

The other is screwing up the weakness level of a table; we had problems with that in Lua 5.0 with metatables IIRC, and I still have to think twice when I do it. This is an argument for the simple case of memoization to be in microlight; that's where it can also document that it does not work how you might think with table keys.

Come to think of it, that's another effect of a microlight: showing off how to do simple operations in Lua, and documenting where common thinkos like {1}=={1} are going to hit you. There is no substitute for reading the manual, but teaching about semantics at the time you're surfing the library documentation can remind people closer to the time of use.

Jay

Strong authentication just proves which chump is in front of the keyboard