[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PATCH: fixes bug with calling garbage collector from custom lua_Alloc
- From: "Robert G. Jakabosky" <bobby@...>
- Date: Fri, 9 May 2008 04:07:59 -0700
On Friday 09, Bogdan Marinescu wrote:
> > That looks like the same step collection code as in the lua_memlimit
> > program.
>
> That's because I'm using your code :) I just adapted it slightly to
> match my data structures.
I found the problem. The GC is disabled during the parsing of the script, so
the step collection never runs and always returns false. I will change it to
return true when the GC is disabled.
Also I am working on moving the memlimit code into the Lua core.
Here is what I am think the C API will look like:
/* get current memlimit in Kbytes */
int memlimit = lua_gc(L, LUA_GCGETMEMLIMIT, 0);
/* set memlimit to 64Kbytes */
lua_gc(L, LUA_GCSETMEMLIMIT, 64);
Lua API:
memlimit = collectgarbage("getmemlimit");
collectgarbage("setmemlimit", 64);
I will most likely use the step collection at memory limit method. The
memlimit can be disabled by setting it to 0 (the default).
--
Robert G. Jakabosky