[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: error in lua_pcall not garbage collecting
- From: John Dunn <John_Dunn@...>
- Date: Thu, 27 Sep 2012 16:52:01 +0000
> Lua does check the collector when it creates error messages, and so the collector does not get a chance to run.
> The error causes Lua to skip that check, too. Replacing that check solves both problems:
>
> *** ldo.c:
> 313a314
> > luaC_checkGC(L); /* stack grow uses memory */
> 340a342
> > luaC_checkGC(L); /* stack grow uses memory */
> 396d397
> < luaC_checkGC(L);
Are you saying that I can modify ldo.c to address the issue? I only see one call to luaC_check(L) which is on line 396 in luaD_call. What exactly should I change?
Right now I'm just calling lua_gc(L, LUA_GCCOLLECT, 0) any time lua_pcall() returns an error. While probably horribly inefficient it does appear to address my issue.