[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Garbage collection / finalization of Lua functions
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 6 Sep 2015 10:08:08 +0100
In Ravi, I found that when auto compiling all Lua functions, the
memory usage increases greatly during the running of Lua tests. The
problem has become apparent when running tests with -port=true;
previously I was running tests with -U=true.
The issue seems to be because in JIT mode each compiled function has
associated with it the LLVM module, execution engine plus the
generated code. But Lua's garbage collector is unaware of the size of
the function objects - hence the rate at which these objects are
collected / finalized is not fast enough.
Putting a call to lua_gc(L, LUA_GCSTEP, 200) after every JIT
compilation seems to help but then causes tests in gc.lua to fail
(don't know why).
For now I have put in a call to lua_gc(L, LUA_GCCOLLECT, 0) after
every n JIT compilations - n can be configured. This is crude but
appears to limit the amount of memory being used. A better solution is
required - one that doesn't cause a full GC.
Any pointers on where I should look for how to solve this in a better way?
Thanks and Regards