lua-users home
lua-l archive

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




On 27/12/16 01:33 PM, steve donovan wrote:
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?

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.

There's also this:

public class WrapperLuaState {
  private WrapperLuaState() {}
  public static WrapperLuaState newState() {
    WrapperLuaState wls = new WrapperLuaState();
WeakReference<WrapperLuaState> wref = new WeakReference(wls, refqueue);
return wls;
  }
}

(PS: Idk how to actually use this.)

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.