MCPcopy Create free account
hub / github.com/PlutoLang/Pluto / luaM_realloc_

Function luaM_realloc_

src/lmem.cpp:176–189  ·  view source on GitHub ↗

** Generic allocation routine. */

Source from the content-addressed store, hash-verified

174** Generic allocation routine.
175*/
176void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
177 void *newblock;
178 global_State *g = G(L);
179 lua_assert((osize == 0) == (block == NULL));
180 newblock = firsttry(g, block, osize, nsize);
181 if (l_unlikely(newblock == NULL && nsize > 0)) {
182 newblock = tryagain(L, block, osize, nsize);
183 if (newblock == NULL) /* still no memory? */
184 return NULL; /* do not update 'GCdebt' */
185 }
186 lua_assert((nsize == 0) == (newblock == NULL));
187 g->GCdebt -= cast(l_mem, nsize) - cast(l_mem, osize);
188 return newblock;
189}
190
191
192void *luaM_saferealloc_ (lua_State *L, void *block, size_t osize,

Callers 3

luaM_saferealloc_Function · 0.85
allocateImplMethod · 0.85
reallocateImplMethod · 0.85

Calls 2

firsttryFunction · 0.85
tryagainFunction · 0.85

Tested by

no test coverage detected