[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Heap memory issues for Embedded Systems
- From: Glenn Maynard <glenn@...>
- Date: Thu, 7 Jul 2005 20:37:00 -0400
On Tue, Jul 05, 2005 at 09:42:51PM -0300, Luiz Henrique de Figueiredo wrote:
> > For an allocated block, the overhead should be exactly four bytes
> > --- the size of the block, and depending on your application you might not
> > need that (if the app keeps track of the size of blocks itself, for example).
>
> Lua does keep track of block sizes.
I think most C++ allocators take advantage of that; it's one reason C++
allocators can be much more efficient than C malloc/free. They don't
support realloc, though.
I wonder if it'd be a win, for allocation speed and memory fragmentation,
if Lua could be convinced to hook into C++-style allocation through callbacks.
I havn't profiled memory use or allocation counts recently in my code to see
if it's relevant, and I don't know enough about Lua to know if it makes a lot
of small allocations.
--
Glenn Maynard