How does lua_newuserdata align the allocated memory? Does it depend on malloc/calloc, or does it do it's own thing? Is there any way to guarantee alignment without having to add code for this?
Writing alignment code myself isn't a problem, but if it's not needed then I'd rather not, of course.
All memory allocation in Lua is done throughout a user-supplied allocator given when you create a state with lua_newstate
.
If you use luaL_newstate
instead of lua_newstate
, then Lua uses a memory allocator based on realloc
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.