re-apply "keepalive" GC fixes to luainterface mode in emuhawk; maybe it will actually work now and not result in crashes. at least we should check it.
This commit is contained in:
parent
abcf627e24
commit
d5770fb8a3
|
@ -49,7 +49,7 @@
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
State = RunState.Disabled;
|
State = RunState.Disabled;
|
||||||
if(NLua.Lua.WhichLua == "NLua")
|
//if(NLua.Lua.WhichLua == "NLua")
|
||||||
Thread.GetTable("keepalives")[Thread] = null;
|
Thread.GetTable("keepalives")[Thread] = null;
|
||||||
Thread = null;
|
Thread = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public EmuLuaLibrary()
|
public EmuLuaLibrary()
|
||||||
{
|
{
|
||||||
Docs = new LuaDocumentation();
|
Docs = new LuaDocumentation();
|
||||||
if(NLua.Lua.WhichLua == "NLua")
|
//if(NLua.Lua.WhichLua == "NLua")
|
||||||
_lua["keepalives"] = _lua.NewTable();
|
_lua["keepalives"] = _lua.NewTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
var content = File.ReadAllText(file);
|
var content = File.ReadAllText(file);
|
||||||
var main = lua.LoadString(content, "main");
|
var main = lua.LoadString(content, "main");
|
||||||
lua.Push(main); // push main function on to stack for subsequent resuming
|
lua.Push(main); // push main function on to stack for subsequent resuming
|
||||||
if (NLua.Lua.WhichLua == "NLua")
|
//if (NLua.Lua.WhichLua == "NLua")
|
||||||
{
|
{
|
||||||
_lua.GetTable("keepalives")[lua] = 1;
|
_lua.GetTable("keepalives")[lua] = 1;
|
||||||
//this not being run is the origin of a memory leak if you restart scripts too many times
|
//this not being run is the origin of a memory leak if you restart scripts too many times
|
||||||
|
@ -191,7 +191,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_currThread = _lua.NewThread();
|
_currThread = _lua.NewThread();
|
||||||
_currThread.DoString(command);
|
_currThread.DoString(command);
|
||||||
if (NLua.Lua.WhichLua == "NLua")
|
//if (NLua.Lua.WhichLua == "NLua")
|
||||||
_lua.Pop();
|
_lua.Pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue