tech-userlevel archive

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

Re: Concurrency and malloc()

On Mon, Jan 18, 2010 at 04:00:28PM +0000, Sad Clouds wrote:
> What is the default malloc() on NetBSD, is it jemalloc?


> Also, assume a situation where multiple threads in a process are allocating 
> memory chunks of the same size. Which method do you think would offer better 
> performance:
> 1. Use a general allocator like jemalloc, which has been designed with 
> concurrency in mind. Simply call malloc() to allocate memory as needed.
> 2. Pre-allocate a segment of memory and divide it into equal chunks. This 
> might allow for faster memory allocation than jemalloc, since we know all 
> chunks are the same size and we can tune the algorithm to execute the least 
> number of instructions.

It depends. Memory overhead, whether the thread set changes a lot etc.
There is no single correct answer...


Home | Main Index | Thread Index | Old Index