Static

Jemalloc 5.4.0

First reported by Github ·

The signal ●○○○ Compiled by AI from Github and Hacker News
Why you might care

You can now mark non-reclaimable memory mappings for preferential reuse in jemalloc.

What happened

Jemalloc has released version 5.4.0, a significant update focused on cleaning up technical debt through refactoring, bug fixes, and improved test coverage. Key new features include the addition of EXTENT_ALLOC_FLAG_PINNED for custom extent-allocation hooks to mark non-reclaimable mappings for preferential reuse, and new mallctl interfaces for reporting pinned-memory usage and mutex statistics. The release also allows resuming per-CPU arena selection via thread.arena and enhances the alignment of human-readable and JSON malloc statistics. Incompatible changes include adapting tcache fill and retention targets per bin to observed demand, replacing fixed policies, and removing seven legacy non-experimental controls related to tcache behavior. Several bug fixes address errno preservation, numeric overflow checks, NULL acceptance in free functions, TSD lifecycle edge cases, and potential deadlocks. Optimizations and refactors modularize jemalloc's front end, simplify control dispatch, cap base-block growth, and move background-thread lifecycle operations. Portability improvements address C++ standards, flexible array members, rdtscp detection, and macOS-specific issues, along with fixes for MinGW builds and GCC 16 warnings.

What it means

This release of jemalloc introduces features that allow for more granular control over memory management, particularly for pinned memory allocations. The new EXTENT_ALLOC_FLAG_PINNED flag and associated statistics interfaces enable developers to better understand and manage memory that should not be reclaimed by the garbage collection pipeline, which can be crucial for performance-sensitive applications or those utilizing technologies like HugeTLB pages. The adaptation of tcache fill and retention policies to observed demand also signals a move towards more dynamic and efficient memory pooling, moving away from fixed policies that may not suit all workloads.

The extensive refactoring and modularization in jemalloc 5.4.0 indicate a commitment to maintainability and future development, while the OS abstraction layer aims to improve portability and isolate platform-specific code. These changes, coupled with bug fixes and portability improvements across various platforms, suggest that jemalloc is solidifying its position as a robust and adaptable memory allocator. Developers relying on jemalloc can anticipate a more stable and potentially more performant memory allocation experience, with improved diagnostics for memory usage.

AI-written summary. May contain errors.

Jemalloc