diff options
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ | |||
29 | ** a full GC cycle at every allocation.) | 29 | ** a full GC cycle at every allocation.) |
30 | */ | 30 | */ |
31 | static void *firsttry (global_State *g, void *block, size_t os, size_t ns) { | 31 | static void *firsttry (global_State *g, void *block, size_t os, size_t ns) { |
32 | if (ttisnil(&g->nilvalue) && ns > os) | 32 | if (completestate(g) && ns > os) |
33 | return NULL; /* fail */ | 33 | return NULL; /* fail */ |
34 | else /* normal allocation */ | 34 | else /* normal allocation */ |
35 | return (*g->frealloc)(g->ud, block, os, ns); | 35 | return (*g->frealloc)(g->ud, block, os, ns); |
@@ -146,7 +146,7 @@ void luaM_free_ (lua_State *L, void *block, size_t osize) { | |||
146 | static void *tryagain (lua_State *L, void *block, | 146 | static void *tryagain (lua_State *L, void *block, |
147 | size_t osize, size_t nsize) { | 147 | size_t osize, size_t nsize) { |
148 | global_State *g = G(L); | 148 | global_State *g = G(L); |
149 | if (ttisnil(&g->nilvalue)) { /* is state fully build? */ | 149 | if (completestate(g)) { /* is state fully build? */ |
150 | luaC_fullgc(L, 1); /* try to free some memory... */ | 150 | luaC_fullgc(L, 1); /* try to free some memory... */ |
151 | return (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ | 151 | return (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ |
152 | } | 152 | } |