[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Tons of reallocs in Lua - why?
- From: "Ivan-Assen Ivanov" <ivanassen@...>
- Date: Wed, 20 Dec 2006 13:28:09 +0200
TLSF is not something I have written, it's developed by two Portuguese
researchers:
http://rtportal.upv.es/rtmalloc/
I'm using this implementation:
http://www.baisoku.org/tlsf/index.html
since the original authors released their implementation under GPL,
which means I can't actually use it.
It has very good qualities, suitable for a Lua allocator used in a console game:
- guaranteed constant-time allocs and frees (no loop statements)
- you can supply it with a fixed-size memory block and it will work
entirely inside it - good for fragmentation, good for use on a
fixed-memory machine with no VM, like a game console
- it is NOT thread-safe - we are running our Lua interpreter strictly
from one thread, and we don't need thread-safety from the Lua memory
allocator as long as it is separate from the rest of the system - and
we don't need to pay the thread-safety penalty of the malloc from the
runtime library.
- fixed 4 bytes per block overhead
Best regards,
Assen
PS. In the meantime between my first tests with this TLSF and today,
the author has implemented realloc... I'll try again and report the
results here, if anybody is interested