Object Lifetime Models and Their Effect on Performance and Memory Fragmentation in Specialized C++ Allocators

  • Maksim Martynov Lead Programmer, Playrix Novi Sad, Republic of Serbia
Keywords: C memory allocator, object lifetime, memory fragmentation, pool allocator, segregated free list, monotonic arena, performance benchmarking

Abstract

Modern C++ applications place heterogeneous demands on dynamic memory management. Allocator throughput and memory consumption depend on the workload request profile and on the lifetime model of allocated objects. This work presents an empirical study of four allocators: the system malloc, a monotonic arena, a fixed-size pool allocator, and a segregated free list. A matrix of 39 controlled scenarios is built by factorial variation of the lifetime model (long-lived, FIFO, LIFO, and random order), and the workload parameters: fixed small size, variable size, and churn. Each scenario records throughput and the ratio of reserved memory to peak live allocation volume. Additional experiments at 10× scale and at a reuse fraction of 0.9 expose the stability limits of each strategy. Specialized allocators outperform malloc in throughput by one to two orders of magnitude when the lifetime assumptions of their architecture hold. The pool allocator delivers 86.4 million operations per second on long-lived, fixed-size objects with an overhead coefficient of 1.000× and sustains 81.4 million operations under a 10× load increase. The segregated free list exposes a gap between throughput and memory efficiency: overhead reaches 236.5× under heavy churn, and the 10× scale test pushes the system into a fallback regime, with 2,002,194 capacity-exhaustion operations. A controlled ideal_fit_32 experiment confirms that making all requests fit a single size class does not reduce the overhead of an allocator that eagerly preallocates all size classes. The results justify treating the object lifetime model as a primary design axis for allocators.

References

Alanazi HA, Alanazi AG, Albalawi NS. CacheAware: data locality-aware scheduling for distributed memory systems. Computers, 2026, 15(3), 181. DOI: 10.3390/computers15030181
Dang Z, He S, Zhang X, Hong P, Li Z, Chen X, Song H, Sun XH, Chen G. PMAlloc: a holistic approach to improving persistent memory allocation performance. ACM Trans Comput Syst, 2024, 42(3–4), 1–52. DOI: 10.1145/3643886
Ferreira A, Matias R, dos Santos C. Empirical study on memory allocation patterns in GUI-based applications. In: Proceedings of the IEEE International Conference on Systems, Man, and Cybernetics (SMC 2024), IEEE, 2024, 772–778. DOI: 10.1109/SMC54092.2024.10831777
Gao Y, Xu D, Chen L. Prediction and optimization of memory fragmentation based on eBPF and LightGBM in high-load environments. In: Proceedings of the 2024 7th International Conference on Artificial Intelligence and Pattern Recognition (ICAIPR 2024), ACM, 2024, 798–805. DOI: 10.1145/3703935.3704087
Giannessi R, Biondi A, Biasci A. RT-Mimalloc: a real-time memory allocator for embedded systems. In: Proceedings of the 30th IEEE Real-Time and Embedded Technology and Applications Symposium (RTAS 2024), IEEE, 2024, 173–185. DOI: 10.1109/RTAS61025.2024.00022
Lamprakos CP, Xydis S, Catthoor F, Soudris D. The unexpected efficiency of bin packing algorithms for dynamic storage allocation in the wild: an intellectual abstract. In: Proceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management (ISMM 2023), ACM, 2023, 58–70. DOI: 10.1145/3591195.3595279
Li R, Wu Q, Kavi K, Mehta G, Yadwadkar NJ, John LK. NextGen-Malloc: giving memory allocator its own room in the house. In: Proceedings of the 19th Workshop on Hot Topics in Operating Systems (HotOS 2023), ACM, 2023. DOI: 10.1145/3593856.3595911
Li R, John L, Yadwadkar N. Old is gold: optimizing single-threaded applications with ExGen-Malloc. IEEE Comput Archit Lett, 2025, 24(2), 225–228. DOI: 10.1109/LCA.2025.3587582
Maas M, Kennelly C, Nguyen K, Gove D, McKinley KS, Turner P. Adaptive huge-page subrelease for non-moving memory allocators in warehouse-scale computers. In: Proceedings of the 2021 ACM SIGPLAN International Symposium on Memory Management (ISMM 2021), ACM, 2021, 28–38. DOI: 10.1145/3459898.3463905
Maas M, Andersen DG, Isard M, Javanmard MM, McKinley KS, Raffel C. Combining machine learning and lifetime-based resource management for memory allocation and beyond. Commun ACM, 2024, 67(4), 87–96. DOI: 10.1145/3611018
Navasca C, Maas M, Maniatis P, Lim H, Xu GH. Predicting dynamic properties of heap allocations using neural networks trained on static code: an intellectual abstract. In: Proceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management (ISMM 2023), ACM, 2023. DOI: 10.1145/3591195.3595275
Reitz A, Fromherz A, Protzenko J. StarMalloc: verifying a modern, hardened memory allocator. Proc ACM Program Lang OOPSLA, 2024, 8, 1757–1786. DOI: 10.1145/3689773
Wang R, Xu M, Asokan N. S2malloc: statistically secure allocator for use-after-free protection and more. In: Proceedings of DIMVA 2024, Lecture Notes in Computer Science, vol. 14828, Springer, 2024, 23–43. DOI: 10.1007/978-3-031-64171-8_2
Wang R, Xu M, Asokan N. SeMalloc: semantics-informed memory allocator. In: Proceedings of the 2024 ACM SIGSAC Conference on Computer and Communications Security (CCS 2024), ACM, 2024. DOI: 10.1145/3658644.3670363
Weng W, Uta A, Rellermeyer JS. Brug: an adaptive memory (re-)allocator. In: Proceedings of CCGrid 2024, IEEE, 2024, 67–76. DOI: 10.1109/CCGrid59990.2024.00017
Yang H, Zhao X, Zhou J, Wang W, Kundu S, Wu B, Guan H, Liu T. NUMAlloc: a faster NUMA memory allocator. In: Proceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management (ISMM 2023), ACM, 2023. DOI: 10.1145/3591195.3595276
Zhou J, Silvestro S, Tang SJ, Yang H, Liu H, Zeng G, Wu B, Liu C, Liu T. MemPerf: profiling allocator-induced performance slowdowns. Proc ACM Program Lang OOPSLA, 2023, 7, 1418–1441. DOI: 10.1145/3622848
Zhou Z, Gogte V, Vaish N, Kennelly C, Xia P, Kanev S, Moseley T, Delimitrou C, Ranganathan P. Characterizing a memory allocator at warehouse scale. In: Proceedings of ASPLOS 2024, ACM, San Diego, USA, 2024, 192–206. DOI: 10.1145/3620666.3651350
Published
2026-08-04
How to Cite
Martynov, M. (2026). Object Lifetime Models and Their Effect on Performance and Memory Fragmentation in Specialized C++ Allocators. European Journal of Science, Innovation and Technology, 6(4), 64-76. Retrieved from https://www.ejsit-journal.com/index.php/ejsit/article/view/783
Section
Articles