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

Support for selecting memory allocator #2255

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

sunlei
Copy link
Collaborator

@sunlei sunlei commented Jan 26, 2025

Pull Request

Support for selecting memory allocator.

  • Added as features:
    • allocator-jemalloc
    • allocator-mimalloc
  • In one of my Rust projects with heavy network and computational I/O workloads, both mimalloc and jemalloc outperformed the system allocator:
    • mimalloc + glibc performed better than jemalloc + glibc
      • Both outperformed configurations using + musl
    • Therefore, mimalloc + glibc is recommended.

Type of change

  • New feature (non-breaking change which adds functionality)

Issue

Since the cargo checks in pre-commit are run with --all-features, the logic for choosing between allocators fails to pass the checks. As a temporary workaround, the code related to jemalloc has been commented out. So:

  • Is there a better approach to support a mutually exclusive choice between the two?
  • Or should we simply remove jemalloc and keep only mimalloc?
  • Use tools like https://github.com/taiki-e/cargo-hack ?

Copy link

Thank you for your contribution! 🙏

The pre-commit checks failed, but this is easy to fix. You'll need to run:

make pre-commit
# or
pre-commit run --all-files

This will automatically fix most formatting issues. Just commit any changes and push again.

See our CONTRIBUTING.md guide for more details.

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.

1 participant