mediumslab: limit header to min of page or slab
This had not been observed as an issue prior to923705e514because CMakeLists.txt had, until then, been using EQUAL, not STREQUAL, to test for oe (and to then enable USE_SMALL_CHUNKS). This test would fail, and so the default SLAB_SIZE was used. Absent this min operation, the use of a whole page on a 64KiB page causes a crash when using the largest medium size class, as, ultimately, size classes are not based on page sizes, and so committing a whole page to the header leaves too little room for that class. See also3d3b048776.
This commit is contained in:
committed by
Matthew Parkinson
parent
3e7ea1a85f
commit
b8b5f30513
@@ -100,7 +100,7 @@ namespace snmalloc
|
||||
static constexpr size_t MIN_ALLOC_SIZE = 2 * sizeof(void*);
|
||||
static constexpr size_t MIN_ALLOC_BITS = bits::ctz_const(MIN_ALLOC_SIZE);
|
||||
|
||||
// Slabs are 64 KiB unless constrained to 16 KiB.
|
||||
// Slabs are 64 KiB unless constrained to 16 or even 8 KiB
|
||||
static constexpr size_t SLAB_BITS =
|
||||
USE_SMALL_CHUNKS ? 13 : (USE_LARGE_CHUNKS ? 16 : 14);
|
||||
static constexpr size_t SLAB_SIZE = 1 << SLAB_BITS;
|
||||
|
||||
Reference in New Issue
Block a user