lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


* Richter, Jörg <Joerg.Richter@pdv-FS.de> [15/04/15 13:37]:
> 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?

https://github.com/tarantool/tarantool/blob/master/src/lib/small/README

Never intended as a separate project, but is completely standalone
and does what you need. It has an option to return 32-bit pointers
on 64-bit architecture. 

-- 
http://tarantool.org - a NoSQL database in a Lua script