Skip to content

[mimalloc] Remove no-longer-needed limit on emmalloc alignment#21905

Merged
kripken merged 1 commit intoemscripten-core:mainfrom
kripken:emmalloc.mimalloc.no-min
May 7, 2024
Merged

[mimalloc] Remove no-longer-needed limit on emmalloc alignment#21905
kripken merged 1 commit intoemscripten-core:mainfrom
kripken:emmalloc.mimalloc.no-min

Conversation

@kripken
Copy link
Member

@kripken kripken commented May 7, 2024

#20704 removed the maximum alignment limit from emmalloc, so we no longer
need it in the mimalloc port. Without it, we can properly use the 4GB-aligned pages
that mimalloc requests.

// emmalloc has a minimum alignment size.
#define MIN_EMMALLOC_ALIGN 8
#define MAX_EMMALLOC_ALIGN (1024*1024)
if (try_alignment < MIN_EMMALLOC_ALIGN) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can try_alignment ever be lower than 8 in mimalloc?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think no, since it makes that assumption internally. But we could probably make it do the clamping itself silently, I suppose.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh sorry, you said mimalloc and I read that as emmalloc. I'm not sure. The initial allocations are definitely 4MB-sized, but there may be other incidental allocations in theory in the codebase somewhere.

@kripken kripken merged commit 3cd6861 into emscripten-core:main May 7, 2024
@kripken kripken deleted the emmalloc.mimalloc.no-min branch May 7, 2024 22:52
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