diff options
author | Robin Gareus <robin@gareus.org> | 2016-07-06 03:32:08 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-07-06 03:32:08 +0200 |
commit | a2f249d1d7a14498f9b1c0b46f89be4a7e611c37 (patch) | |
tree | 9a01592aa4209a9b3694c190d10ba809337fc833 /libs/lua | |
parent | aee63fe5a3cc2b718756d7963c0799cbd7728cea (diff) |
tweak lua gc
lua C++ bindings require ~400KB worth of tables now; so bump memory
available to rt-safe scripts (full interpreter) to 2MB.
Also switch to incremental GC.
Diffstat (limited to 'libs/lua')
-rw-r--r-- | libs/lua/lua/luastate.h | 2 | ||||
-rw-r--r-- | libs/lua/luastate.cc | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libs/lua/lua/luastate.h b/libs/lua/lua/luastate.h index 88ffc93486..5a5c939c2a 100644 --- a/libs/lua/lua/luastate.h +++ b/libs/lua/lua/luastate.h @@ -34,6 +34,8 @@ public: int do_command (std::string); int do_file (std::string); void collect_garbage (); + void collect_garbage_step (); + void tweak_rt_gc (); sigc::signal<void,std::string> Print; diff --git a/libs/lua/luastate.cc b/libs/lua/luastate.cc index 546b02a006..3b8a7ae25a 100644 --- a/libs/lua/luastate.cc +++ b/libs/lua/luastate.cc @@ -77,6 +77,17 @@ LuaState::collect_garbage () { } void +LuaState::collect_garbage_step () { + lua_gc (L, LUA_GCSTEP, 0); +} + +void +LuaState::tweak_rt_gc () { + //lua_gc (L, LUA_GCSETPAUSE, 20); + lua_gc (L, LUA_GCSETSTEPMUL, 100); +} + +void LuaState::print (std::string text) { Print (text); /* EMIT SIGNAL */ } |