diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-03 15:18:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-03 15:18:29 -0300 |
commit | b9a1f27250efd0433b93d23b92da19566f9b78e1 (patch) | |
tree | bdfd0b71669e3f7a5e9075ede02c0e59eac0a126 /lmem.c | |
parent | 29aed2880229fa9b9a0284db8a0bd4db76375f7e (diff) | |
download | lua-b9a1f27250efd0433b93d23b92da19566f9b78e1.tar.gz lua-b9a1f27250efd0433b93d23b92da19566f9b78e1.tar.bz2 lua-b9a1f27250efd0433b93d23b92da19566f9b78e1.zip |
do not attempt emergency collection while building state (it is
useless, and state can be inconsistent)
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.88 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.89 2014/11/02 19:33:33 roberto Exp roberto $ |
3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -87,8 +87,10 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { | |||
87 | if (newblock == NULL && nsize > 0) { | 87 | if (newblock == NULL && nsize > 0) { |
88 | api_check( nsize > realosize, | 88 | api_check( nsize > realosize, |
89 | "realloc cannot fail when shrinking a block"); | 89 | "realloc cannot fail when shrinking a block"); |
90 | luaC_fullgc(L, 1); /* try to free some memory... */ | 90 | if (g->version) { /* is state fully built? */ |
91 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ | 91 | luaC_fullgc(L, 1); /* try to free some memory... */ |
92 | newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ | ||
93 | } | ||
92 | if (newblock == NULL) | 94 | if (newblock == NULL) |
93 | luaD_throw(L, LUA_ERRMEM); | 95 | luaD_throw(L, LUA_ERRMEM); |
94 | } | 96 | } |