Glibc Enables A Per-Thread Cache For Malloc - Big Performance Win
Written by Michael Larabel in GNU on 7 July 2017 at 08:39 AM EDT. 35 Comments
GNU --
Glibc has added a per-thread cache to malloc and enabled it by default.

The next glibc release should be exciting with this per-thread cache "tcache" added to the malloc() memory allocator function. This per-thread cache should be a big performance win and is described by the documentation as:
A per-thread cache has been added to malloc. Access to the cache requires no locks and therefore significantly accelerates the fast path to allocate and free small amounts of memory. Refilling an empty cache requires locking the underlying arena. Performance measurements show significant gains in a wide variety of user workloads. Workloads were captured using a special instrumented malloc and analyzed with a malloc simulator.

This new feature is being enabled by default unless --disable-experimental-malloc is passed at build time.

This should be fun for testing and benchmarking. This per-thread malloc cache will be present in the upcoming Glibc 2.26 release.

About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter or contacted via MichaelLarabel.com.

Related GNU News
Popular News