On 23. Jul 2017, at 8:12, François Perrad <[email protected]> wrote:Hello Jakub,A best practice is to use `lua_getallocf` instead of the C `malloc`/`free`.By this way, your extension uses the same allocator than the Lua interpreter.See the reference manual:https://www.lua.org/manual/5.3/manual.html#lua_getallocfhttps://www.lua.org/manual/5.3/manual.html#lua_AllocSee an example:https://github.com/fperrad/lua-csnappy/blob/master/lsnappy.c#L18-L35François