lua-users home
lua-l archive

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


On Wed, Mar 29, 2017 at 10:51 PM, John Dunn <> wrote:
> It seems like a way to tag something to always be garbage collected as soon as there are no longer any references might work.

This idea is it needs two parts. One to detect the "as soon as there
are no longer any references" plus another to "tag something to..." (
and implement the special collections for this ). If you have the
first one, why bother with the second, just _gc it instead of tagging.

Reference counting is something which must either be built deeply into
the language ( like perl or C-python ) or be implemented in a language
which gives you more control on your data ( like C++, where you can
mix manually managed, reference counting and garbage-collected data in
the same program ). I, particularly, would love to have a way to
choose ( as my objects typically split into two categories, things
like sockets, db handles, files, which do not participate in cycles (
or can easily be made not to ) and would like to have managed in a
release-fast way and memory-chunk-like data which I do not care when
it is freed. That's why I favour C++ ways, where I manage my heavy
resources with reference counting and use garbage collectors or memory
pools ( where you free the whole pool ) for things like graphs.

Francisco Olarte.