-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mimalloc] Halve the page size #23037
base: main
Are you sure you want to change the base?
Conversation
What is the benefit here? Did you measure this @kleisauke ? |
The advantage is that mimalloc uses 2 MiB alignments instead of 4 MiB, which causes emmalloc (and @@ -1,12 +1,12 @@
initialize_emmalloc_heap()
claim_more_memory(numBytes=48)
-claim_more_memory: claimed 0x0050ed80 - 0x0050edb0 (48 bytes) via sbrk()
+claim_more_memory: claimed 0x0050edc0 - 0x0050edf0 (48 bytes) via sbrk()
claim_more_memory: sbrk() returned a disjoint region to last root region, some external code must have sbrk()ed outside emmalloc(). Creating a new root region
-allocate_memory(align=4194304, size=4194304 bytes)
-claim_more_memory(numBytes=8388656)
-claim_more_memory: claimed 0x0050edb0 - 0x00d0ede0 (8388656 bytes) via sbrk()
+allocate_memory(align=2097152, size=2097152 bytes)
+claim_more_memory(numBytes=4194352)
+claim_more_memory: claimed 0x0050edf0 - 0x0090ee20 (4194352 bytes) via sbrk()
claim_more_memory: sbrk() returned a region contiguous to last root region, expanding the existing root region
-allocate_memory(align=4194304, size=4194304 bytes)
-attempt_allocate(freeRegion=0x0050ed90,alignment=4194304,size=4194304)
-attempt_allocate - succeeded allocating memory, region ptr=0x007ffffc, align=4194304, payload size=4194304 bytes)
+allocate_memory(align=2097152, size=2097152 bytes)
+attempt_allocate(freeRegion=0x0050edd0,alignment=2097152,size=2097152)
+attempt_allocate - succeeded allocating memory, region ptr=0x005ffffc, align=2097152, payload size=2097152 bytes) (before commit 3cd6861 this issue did not occur because an internal alignment of 1 MiB in mimalloc was always enforced) This was only verified on wasm-vips' test suite, which somehow consistently exceeds the I should also verify this on Emscripten's benchmarks. They need to be redone anyway, the previous benchmarks was done with assertions enabled in emmalloc (i.e. before commit d0a2dce), which may have affect the results. emscripten/test/test_benchmark.py Lines 968 to 972 in 58889f9
|
Sounds good. Yeah, if this does not regress that benchmark then it seems reasonable to me. And meanwhile I see that this is recommended for "small systems", which probably describes most wasm usage: microsoft/mimalloc#647 (comment) |
No description provided.