MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / tryagain

Function tryagain

extlibs/lua/src/lmem.c:146–154  ·  view source on GitHub ↗

** In case of allocation fail, this function will call the GC to try ** to free some memory and then try the allocation again. ** (It should not be called when shrinking a block, because then the ** interpreter may be in the middle of a collection step.) */

Source from the content-addressed store, hash-verified

144** interpreter may be in the middle of a collection step.)
145*/
146static void *tryagain (lua_State *L, void *block,
147 size_t osize, size_t nsize) {
148 global_State *g = G(L);
149 if (ttisnil(&g->nilvalue)) { /* is state fully build? */
150 luaC_fullgc(L, 1); /* try to free some memory... */
151 return (*g->frealloc)(g->ud, block, osize, nsize); /* try again */
152 }
153 else return NULL; /* cannot free any memory without a full state */
154}
155
156
157/*

Callers 2

luaM_realloc_Function · 0.85
luaM_malloc_Function · 0.85

Calls 1

luaC_fullgcFunction · 0.85

Tested by

no test coverage detected