lua-users home
lua-l archive

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


Roberto:

On Mon, Jun 3, 2019 at 4:17 PM Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> Maybe this is a good description:
>   Whenever the memory for an object could be released if it did
>   not have a finalizer nor weak references, its finalizer can be
>   called and the weak references erased.

It can be done, and may be useful if you put a lot more optimization
in the code generator. I think the current version, alive while in a
local, already implements it, which gives a nice starting point for
incremental evolution.

It cannot lead to problems on the C extension side unless you are able
to examine the C code, which I doubt anyone will try.

I do not see the point of this "make things collectable ASAP",
"agressively reuse everything", but from now on I'll assume it is the
direction this is gonna take and act acordingly. I thought of lua as a
simple language, simple rules. Finalizers run when collecting. Objects
referenced by anything are not collectable ( that new definition means
even if I stash something in a table it may get collected if the
optimizer determines I do not touch that particular key, instead of
waiting till the whole table is collected because I do not touch it
anymore ). I just held my data alive where needed, let it die when not
usable and tried to accelerate some things with some strategic
"collectgarbage" at iddle points, but I'll just switch to open/pcall
dowathever/close, it will cut my resource footprint along the way.
I've been using that pattern in C/Java/Pascal/assembly etc for enough
time.

I still think the current behaviour is good, not collectable until
locals goes out of scope ( no longer sure if this is real but I think
it is).

Not gonna argue more, your language, your rules. Just keep writing
manuals good enough to let me infer the behaviour of the corresponding
version, or announce it if you stop. As long as it has a half decent
spec I am normally able to follow it and yours are normally good
enough.

Francisco Olarte.