[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua vs LuaJIT, compatibility on GC behaviour for weak tables
- From: Francesco Abbate <francesco.bbt@...>
- Date: Tue, 1 Feb 2011 20:55:42 +0100
2011/2/1 Mike Pall <mikelu-1102@mike.de>:
> But this is not a compatibility question. Specific GC behavior is
> undocumented on purpose. It's completely up to the GC to decide
> when to release an object (or if at all) or when to clear a weak
> table entry. There are no other rules. Period.
Hi Mark,
thank you for the reply but I think that what you saying is not
completely accurate. As Roberto is pointing out the Lua manual clearly
affirm that the objects in a weak tables are removed when the they are
collected.
> Your code is broken if it relies on any particular GC behavior.
I see that my questions about the GC are always annoying but I was
asking that because I need to make some assumptions about how the GC
behaves with weak tables and no, my code is not broken.
I have actually made a very simple patch to Lua to correct this very
odd behaviour and since then my application works perfectly. Since you
are saying that LuaJIT use the same GC this means that I will be able
to apply the same patch to LuaJIT2 :-)
This is why free software is great, you can patch the code even
against the will of the original authors :-)
Being more serious, I have the impression that you reason from the
point of view of pure Lua applications. In this case it is certainly
true that you don't have to care a lot about how GC is doing its work.
For the other side if you try to write applications that mix C++
objects and Lua you may encounter many problems related to GC, cross
references, finalization order, but I will stop here, I don't want to
be boring...
Cheers
Francesco