Can we avoid the heap allocation in macOS Mutex/Condvar?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This was brought up over here: our current macOS implementation for Mutex and Condvar use heap allocations. That's unfortunate because it can lead to OOM, and also seems like a slight efficiency hit.
Heap allocations are required because we are using the pthread API on macOS, and pthread Mutexes are not movable. AFAIK, @joboet has been working on alternative implementations that avoid the pthread API (https://github.com/rust-lang/rust/pull/122408). The alternative, suggested by @daira , is to get Apple to guarantee that their pthread mutexes are movable under certain conditions. Given the black box that Apple is, I have no idea if that's even remotely realistic. But anyway it seems worth tracking this somewhere so here we go. :)
Contributor guide
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.
Research direction
Start by reading the linked discussion in issue #93740 and the alternative implementation in pull request #122408. The work is complete when the macOS Mutex and Condvar implementation avoids heap allocation without changing their required behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100