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

Function luaL_alloc

src/lauxlib.cpp:1194–1213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1192
1193
1194void *luaL_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
1195#ifndef PLUTO_MEMORY_LIMIT
1196 UNUSED(ud); UNUSED(osize);
1197#endif
1198 if (nsize == 0) {
1199 free(ptr);
1200 return NULL;
1201 }
1202 else {
1203#ifdef PLUTO_MEMORY_LIMIT
1204 if (ud /* state has finished opening? */
1205 && (!ptr || nsize > osize) /* new allocation or increasing existing allocation? */
1206 && reinterpret_cast<global_State*>(ud)->totalbytes >= PLUTO_MEMORY_LIMIT /* limit reached? */
1207 ) {
1208 return NULL;
1209 }
1210#endif
1211 return realloc(ptr, nsize);
1212 }
1213}
1214
1215
1216/*

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected