Just FYI: Lua also allows you to provide your own allocator function.
In fact, the core API function to create a new Lua state (lua_newstate()) requires an allocator function but usually people use a library API function (luaL_newstate()) for state creation that calls the core API using an allocator based on the standard C functions.