Rust bindings: MiMalloc::allocate should return actual usable size
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 66/100
Research direction
Start in contrib/rust/src/allocator.rs around the allocate method that currently returns exactly layout.size(), and read the linked purpleprotocol nightly_allocator_api.rs for the pattern. Check how mimalloc exposes its usable-size function through the existing FFI bindings in the same crate, then return that value instead. Run cargo test in contrib/rust; done means the allocator reports the larger usable block while still satisfying the Allocator contract.
Written by the indexing model from the issue text.
Description
Connections
https://github.com/microsoft/mimalloc/issues/1405 - Support official Rust FFI bindings
Summary
The Rust bindings for mimalloc always return an allocation of exactly the requested size:
However, the allocator API says:
The returned block may have a larger size than specified by layout.size()
As such, I'd propose doing something similar to what purpleprotocol's Rust bindings do:
This would help improve the performance of collection types (like Vec) by allowing them to use the full space of the allocation.
- Dominant language
- C
- Stars
- 13.6k
- Forks
- 1.2k
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 18
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/mimalloc
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Building mimalloc with `-Wundef` compiler flag logs many warnings on undefined macrosPossibly taken @vstinner claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/mimalloc#1506 · 5 comments ·
Maintainers usually reply within 1 day
-
stale
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
microsoft/mimalloc#1113 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
microsoft/mimalloc#886 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/mimalloc#368 · 1 comment ·
Maintainers usually reply within 1 day
All issues in microsoft/mimalloc
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
ESPresense/ESPresense#2680 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ImageMagick/ImageMagick#9134 ·
Maintainers usually reply within 1 day
-
Builder: a structure opened without calculation data shows the Diffraction (fibre) view by defaultOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
FriendsofECCE/ECCE#1245 · 1 comment ·
-
Arch: ARM/AArch64 Doc
Difficulty 1/5 Under an hour Newbie friendliness 90/100
RT-Thread/rt-thread#12082 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/nuttx-apps#4108 · 4 comments ·
Maintainers usually reply within 1 day