lua-users home
lua-l archive

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



Am 27.12.16 um 16:33 schrieb steve donovan:
> On Tue, Dec 27, 2016 at 5:15 PM, Marc Balmer <marc@msys.ch> wrote:
>> (The last part is annoying, I don't know yet how to hook that to the
>> Java garbage collector, Java lacks metamethods...)
> 
> There's finalize(), but people say, don't use it, because you don't
> know when it happens. Although no more evil than when we do in Lua,
> not so?

You are never sure if finalize() gets called or not, yes.  So I think an
explicit close() is safer.

> The most challenging part of mixing Lua and Java (I found) is keeping
> two garbage collectors going. I managed to cut down on the garbage
> generation created by Java reflection.  Relevant because generally in
> Android you release big resources manually anyway - better to be
> explicit.

I can not comment on that, I just don't have a production program ready
yet...  But being able to use Lua from Java is already nice, it means
Jave code can now as easily be scripted as C and C++ code.