ravi
ravi copied to clipboard
Too much memory being consumed during some tests
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) seems to help but then causes tests in gc.lua to fail.
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.