Rob Kendrick wrote: > On Tue, 27 Apr 2010 22:48:50 +0100 > James Peacock <[email protected]> wrote: > >> If you have lots smallish objects with a wide range of lifetimes you >> can massively reduce fragmentation by using a pool allocator of some >> sort to collect objects of a similar lifetimes into larger chunks of >> memory. I've seen techniques such has this solve address space >> fragmentation issues we had with a project on 32 bit linux. In the >> case of RISC OS, the C runtime won't give the memory back, but at >> least it will be less fragmented and, hopefully, the total memory >> used will be less. > > My understanding is that UnixLib already includes such a slab > allocator. (It uses dlmalloc, which is the same library glibc under > Linux uses.)
I think you've missed my poiny. It is more that just 'slab' allocation. The important thing is allocating blocks with similar lifetimes from the same pool. This cannot be done by malloc as there is no way to pass that information to it. James
