I want to optimize a program that has a lot of Lua states. If the process size gets
around 10-20G a lot of time is spend in system-malloc. I think it is because of the
sheer amount of small memory objects and the frequent allocation/deallocation
that comes with a dynamic language.
To reduce memory fragmentation I want to create every Lua state with an own
allocator instance. Every instance should get its memory from one or more large
mmap’ed blocks. This blocks should not be shared between different Lua states.
If one state gets closed all corresponding blocks can be freed very fast and the
process-malloc is not bothered to clean up so many small objects.
Now I am looking for a library that does exactly that. This means it must be able to
create different allocation-contexts with corresponding malloc/free interface.
Does anybody know of such a library?