Skip to content

[mimalloc] Disable -sABORTING_MALLOC by default - #28127

Open
kleisauke wants to merge 1 commit into
emscripten-core:mainfrom
kleisauke:mimalloc-disable-aborting-malloc-default
Open

kleisauke wants to merge 1 commit into
emscripten-core:mainfrom
kleisauke:mimalloc-disable-aborting-malloc-default

Conversation

@kleisauke

Copy link
Copy Markdown
Collaborator

Allows mimalloc to handle allocation failures from its underlying
emmalloc allocator and fall back gracefully.

This is an alternative to the mi_prim_heap_has_room() check
introduced in microsoft/mimalloc@0fec3da, which Emscripten does not
use.

Allows mimalloc to handle allocation failures from its underlying
emmalloc allocator and fall back gracefully.

This is an alternative to the `mi_prim_heap_has_room()` check
introduced in microsoft/mimalloc@0fec3da, which Emscripten does not
use.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the configuration for mimalloc to default to a non-aborting malloc behavior (ABORTING_MALLOC=0), allowing it to gracefully handle allocation failures from its underlying emmalloc allocator. Consequently, the explicit -sABORTING_MALLOC=0 flag has been removed from the mimalloc test cases in test/test_core.py. Additionally, a comment in tools/system_libs.py was updated to clarify the usage of the page map in mi_free(). There are no review comments, so I have no feedback to provide.

Comment thread tools/system_libs.py
Comment on lines +1898 to +1899
# always use the page map in `mi_free()`, as we don't support large
# aligned allocations well (needed for aligned page metadata)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by: I've synced this comment with:

// Always use the page map in `mi_free` on CHERI as we cannot derive the page meta-data from a (bounded) user pointer,
// and on WebAssembly as it cannot do large aligned allocations well (needed for aligned page meta-data).

@sbc100 sbc100 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But don't we want the default behaviour of ABORTING_MALLOC to be the same for all allocators.

i.e. does ABORTING_MALLOC work at the mimalloc level? Perhaps it should?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants