diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.240 2017/11/30 15:37:16 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.241 2017/12/01 17:38:49 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -816,18 +816,13 @@ static GCObject **sweeptolive (lua_State *L, GCObject **p) { | |||
816 | */ | 816 | */ |
817 | 817 | ||
818 | /* | 818 | /* |
819 | ** If possible, shrink string table (protected from memory errors). | 819 | ** If possible, shrink string table. |
820 | */ | 820 | */ |
821 | static void shrinkstrtable (lua_State *L, void *ud) { | ||
822 | luaS_resize(L, *cast(int*, ud) / 2); | ||
823 | } | ||
824 | |||
825 | |||
826 | static void checkSizes (lua_State *L, global_State *g) { | 821 | static void checkSizes (lua_State *L, global_State *g) { |
827 | if (!g->gcemergency) { | 822 | if (!g->gcemergency) { |
828 | l_mem olddebt = g->GCdebt; | 823 | l_mem olddebt = g->GCdebt; |
829 | if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ | 824 | if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ |
830 | luaD_rawrunprotected(L, &shrinkstrtable, &g->strt.size); | 825 | luaS_resize(L, g->strt.size / 2); |
831 | g->GCestimate += g->GCdebt - olddebt; /* correct estimate */ | 826 | g->GCestimate += g->GCdebt - olddebt; /* correct estimate */ |
832 | } | 827 | } |
833 | } | 828 | } |