From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Tue, 6 Dec 2011 14:20:15 +0100 Subject: [PATCH] GC may get stuck during parsing and avoids proper resizing of the string table, making its lists grow too much and degrading performance. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comes from http://www.lua.org/bugs.html#5.1.4-6 reported by Sean Conner on 10 Nov 2009. Signed-off-by: BenoƮt Burnichon --- src/llex.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/llex.c b/src/llex.c index 6dc3193..92d6575 100644 --- a/src/llex.c +++ b/src/llex.c @@ -118,8 +118,10 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { lua_State *L = ls->L; TString *ts = luaS_newlstr(L, str, l); TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ - if (ttisnil(o)) + if (ttisnil(o)) { setbvalue(o, 1); /* make sure `str' will not be collected */ + luaC_checkGC(L); + } return ts; }