Re: A few questions about memory allocation
"'Sainan' via lua-l" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <Wy7U64mXJDuclnPJQqxysD3ujffEZfETBIKrDcJOUk68MdK381SHyZESZYTbtnlQoGd6J45pD4XPRAQaQ1lzFe2alwZaePcaDGfebLCfCd8=@calamity.inc> |
When Lua wants to allocate, resize, or free, an allocation, it defers that job to the 'frealloc' function, which you can pass to lua_newstate or set with lua_setallocf. If instead you use luaL_newstate, the function looks like this: return nsize == 0 ? (free(ptr), nullptr) : realloc(ptr, nsize); -- Sainan -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/Wy7U64mXJDuclnPJQqxysD3ujffEZfETBIKrDcJOUk68MdK381SHyZESZYTbtnlQoGd6J45pD4XPRAQaQ1lzFe2alwZaePcaDGfebLCfCd8%3D%40calamity.inc.