On 23. Jul 2017, at 8:12, François Perrad <francois.perrad@gadz.org> 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