Skip to content
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

Add mimalloc support for macOS and Linux #663

Merged
merged 10 commits into from
Mar 23, 2025
Merged

Add mimalloc support for macOS and Linux #663

merged 10 commits into from
Mar 23, 2025

Conversation

DubbleClick
Copy link
Collaborator

@DubbleClick DubbleClick commented Mar 20, 2025

What does this PR do?

add mimalloc as an optional library.
if building with --with-libs="mimalloc", it replaces the libc allocator.

Fix #662

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php, run composer cs-fix at local machine.
  • If it's an extension or dependency update, make sure adding related extensions in src/global/test-extensions.php.
  • If you changed the behavior of static-php-cli, update docs in ./docs/.
  • If you updated config/xxx.json content, run bin/spc dev:sort-config xxx.

@crazywhalecc
Copy link
Owner

Is it linux-only feature?

@DubbleClick
Copy link
Collaborator Author

DubbleClick commented Mar 20, 2025

no, this works on macos too.

on windows it would work too, but there's less benefit to it. fully static windows builds can still preload the shared mimalloc library if someone wants and msvc's default allocator is fast anyway.

@DubbleClick
Copy link
Collaborator Author

this will majorly simplify frankenphp's mimalloc build (can get rid of the whole patch code and only need to set buildroot/lib/mimalloc.o as the first "library" in CGO_LDFLAGS.

it's also nice for static-php-cli compiling cli/fpm because musl's allocator is awfully slow in threaded scenarios

@crazywhalecc crazywhalecc added new feature New feature or request kind/dependency Issues related to dependencies labels Mar 20, 2025
@crazywhalecc crazywhalecc changed the title Feat/mimalloc Add mimalloc support for macOS and Linux Mar 20, 2025
@crazywhalecc
Copy link
Owner

Ready to merge?

@DubbleClick
Copy link
Collaborator Author

in theory yes, chinese docs are missing and some php 8.1 tests seem to fail

@DubbleClick
Copy link
Collaborator Author

never mind, chinese dovs are not missing :)

@DubbleClick
Copy link
Collaborator Author

Ready to merge?

yes ready to merge now

@DubbleClick DubbleClick merged commit d0a66ab into main Mar 23, 2025
9 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/dependency Issues related to dependencies new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to link against MIMALLOC statically
3 participants