Johny Mattsson 085f35da73 Tie in the EGC with the SDK's heap knowledge. (#2319)
Added `node.egc.meminfo()` to expose LVM usage (to make the regular
`node.egc.ON_MEM_LIMIT` option usable).

Extended the `node.egc.ON_MEM_LIMIT` option to also take negative limits,
in which case that's taken as a request to keep a certain amount of heap
available for non-Lua use.
2018-04-06 14:52:03 +02:00

14 lines
248 B
C

// Lua EGC (Emergeny Garbage Collector) interface
#include "legc.h"
#include "lstate.h"
#include "c_types.h"
void legc_set_mode(lua_State *L, int mode, int limit) {
global_State *g = G(L);
g->egcmode = mode;
g->memlimit = limit;
}