By RickRamsey-Oracle on Mar 15, 2012
Does the memory allocation of your multi-threaded application look like this?
That's probably because you're using a memory allocator designed for single-thread, single-CPU applications. Those memory allocators use
free() to reserve a portion of memory for your application, and then release it.
That type of memory allocator can continue to work in an application that ventures timidly into the possibilities of a multi-core, multithread-capable system. However, as the thread count begins to increase, different threads will start to request access to memory at the same time, and the traditional memory allocator won't be able to keep up.
Rick Weisner explains how memory allocation has evolved over the years, then shows you how to recognize a performance deficiency in your multithreaded application. Then he describes how to use three MT-aware memory allocators to take advantage of the performance promises of multi-core systems:
mtmemlockshipped with Oracle Solaris
libumemshipped with Oracle Solaris
hoardallocator, publicly available
Stop the madness. Read Rick Weisner's article.- Rick (Ramsey)