Skip to content

Commit 82cc186

Browse files
committed
Derive PAS_MAX_OBJECTS_PER_PAGE from small page size
The previous hardcoded 2048 assumed PAS_SMALL_PAGE_DEFAULT_SIZE=16KB. With 64KB pages, num_alloc_bits = page_size >> min_align_shift can reach 8192 (utility heap, PAS_INTERNAL_MIN_ALIGN_SHIFT=3), causing pas_baseline_allocator_attach_directory to PAS_ASSERT when a thread hits the baseline allocator slow path.
1 parent 0e6a066 commit 82cc186

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Source/bmalloc/libpas/src/libpas/pas_internal_config.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@
152152

153153
#define PAS_NUM_BASELINE_ALLOCATORS 32u
154154

155-
#define PAS_MAX_OBJECTS_PER_PAGE 2048
155+
/* Must be >= max(page_size >> min_align_shift) across all segregated configs.
156+
Utility heap uses PAS_INTERNAL_MIN_ALIGN_SHIFT (3) with the small page. */
157+
#define PAS_MAX_OBJECTS_PER_PAGE (PAS_SMALL_PAGE_DEFAULT_SIZE >> PAS_INTERNAL_MIN_ALIGN_SHIFT)
156158

157159
#define PAS_MPROTECT_DECOMMITTED PAS_ENABLE_TESTING
158160

0 commit comments

Comments
 (0)