blob: f748372daa0d8a4b03ccf35a67e85b2d638f4f01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= <benoit.burnichon@airtag.com>
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 <benoit.burnichon@airtag.com>
---
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;
}
|