On May 18, 2016, at 2:14 AM, Yoav Steinberg <[email protected]> wrote: > I recently moved from jemalloc 3.x to 4.0.4 and I noticed my 513MB > allocations jumped to over 600MB allocations. Digging into the code I see > huge allocations are now done using size classes > (https://github.com/jemalloc/jemalloc/commit/560a4e1e01d3733c2f107cdb3cc3580f3ed84442). > > > This leads to huge internal fragmentation for such allocations. Did anyone > consider this degradation when making the change? Is there any clean way to > revert to non size classed huge allocations? What's the advantage of size > classed huge allocations?
The size class change actually *decreases* worst case internal fragmentation relative to allocation size from 50% to 20%. For example, malloc(4 MiB + 1) results in a 5 MiB allocation with jemalloc 4.x, rather than 8 MiB with 3.x. Furthermore, in the case of huge size classes, the internal fragmentation only matters in terms of virtual memory if the application doesn't use the extra space, since no physical pages are ever required. If maximum 20% internal fragmentation is too high for your tastes, you can configure with --with-lg-size-class-group=3 or 4 to drop maximum internal fragmentation to 11% or 6%, respectively. But, if you do that you will likely increase external fragmentation as a side effect. Jason _______________________________________________ jemalloc-discuss mailing list [email protected] http://www.canonware.com/mailman/listinfo/jemalloc-discuss
