rust-lua53
rust-lua53 copied to clipboard
Different memory allocation strategies
Rust uses jemalloc for binaries (if possible), but lua's states created with luaL_newstate uses default system allocator. Different allocation strategies makes memory management wild.
What about to use lua_newstate directly with Rust's default allocator. With rust-lang/rust#27389 feature allocator can be overriden and it's cool to use homogeneous allocation strategy, fully managed by developer (inside and outside lua).
We can implement it as pluggable feature :+1:
Do you think it's important to expose custom allocation at the library level, or would it be sufficient to override the system allocators with Rust allocators? If the latter, I can open a PR with an I-think-working implementation.
@SpaceManiac I mean to use alloc feature which wraps RFC's generics. I've pushed my idea with #52 how I made it. What about your version?
I worked on an implementation which would be usable on stable, essentially accessing the allocations API through the stable interface exposed by Vec. I can open a PR with it, but I need to work out alignment behavior.