mlua-rs/rlua

Use std::alloc instead of libc::malloc?

nazar554 opened this issue · 1 comments

Since now alloc is stable, we can use methods from there. handle_alloc_error can be used to abort on failure

Given the architecture-specific alignment code required I don't think this is a desirable change as is.
However I do think it would be useful to allow replacing the Lua allocator externally; for example by adding a Lua::new_with_allocator(LuaAlloc alloc) where LuaAlloc would provide the alloc/dealloc functions. To be able to get rid of the libc dependency (for example for #132) the original Lua::new() could be put behind a libc Cargo feature (which would be enabled by default).