Are memory allocators really worth the trouble? What situations merit their use? How are they applied effectively? What’s the performance impact? This practical talk by large-scale C++ expert John Lakos demonstrates that having local memory allocators in your tool box may lead to as much as order-of-magnitude speed improvements.
The runtime implications of the physical location of allocated memory are sometimes overlooked—even in the most performance-critical code. In this talk, we will examine how the performance of long-running systems can degrade when using just one global allocator (e.g., via new/delete). We will contrast the use of global allocators with various kinds of local allocators—allocators that allocate memory for a well-defined subset of objects in the system. We will also demonstrate how local allocators can reduce, if not entirely prevent, degradation seen in systems that rely solely on the global allocator. Six dimensions—fragmentability, allocation density, variation, utilization, locality, and contention—will be introduced to help characterize a given subsystem, assess the potential for accelerating its runtime performance, and—where appropriate—aid in determining the best local allocator to do so. Empirical evidence will be presented to demonstrate that introducing an appropriate local allocator can often result in substantial reductions in run times (compared with a similar system relying solely on just a single, global allocator).