Async Allocators
Self-Directed Research Self-Directed Research
98 subscribers
344 views
22

 Published On Oct 16, 2024

A deep dive into the potential benefits, and awkward drawbacks, by making all allocations async and fallible

Visit https://sdr-podcast.com/episodes/asyn... to see the show notes and transcript!

CodeCrafters is a service for learning programming skills by _doing_. Visit our referral link at
https://app.codecrafters.io/join?via=... to start your free trial. If you decide to upgrade, you'll get a discount and a portion of the sale will support this podcast.

[00:00:00] Intro
[00:01:13] Making allocators async is a bad geat idea
[00:01:41] GlobalAlloc trait
[00:03:26] Allocator trait
[00:04:11] What does it meant to be "out of memory"?
[00:06:13] Handling reality in "userspace"
[00:08:54] Code example: alloc & dealloc
[00:09:58] Challenge 1: `drop` isn't `async`
[00:13:00] But that's not actually asynchronous, right?
[00:15:13] Challenge 2: `alloc::collections` isn't `async`
[00:17:37] Challenge 3: you can't "turn off" non-`async` allocations
[00:19:58] Linker trick

Show Notes

Episode Sponsor: CodeCrafters (https://app.codecrafters.io/join?via=...)

Eliza Weisman (https://www.elizas.website/)
malloc and free (https://en.wikipedia.org/wiki/Memory_...)
`GlobalAlloc` (https://doc.rust-lang.org/std/alloc/t..., Functions `alloc` (https://doc.rust-lang.org/std/alloc/f...) & `dealloc` (https://doc.rust-lang.org/std/alloc/f...)
Allocator (https://doc.rust-lang.org/std/alloc/t...) trait, NonNull (https://doc.rust-lang.org/std/ptr/str...)
MMU: Memory management unit (https://en.wikipedia.org/wiki/Memory_...)
Mnemos (https://mnemos.dev/mnemosprojectoverv...)
drop (https://doc.rust-lang.org/std/mem/fn....)
intrusive linked lists (https://www.data-structures-in-practi...)
destructors (https://doc.rust-lang.org/reference/d...)
tokio (https://tokio.rs/) an asynchronous runtime for Rust
Vec (https://doc.rust-lang.org/stable/std/..., HashMap (https://doc.rust-lang.org/stable/std/..., Box (https://doc.rust-lang.org/stable/std/...) and Arc (https://doc.rust-lang.org/stable/std/...)
Miri (https://github.com/rust-lang/miri), union (https://doc.rust-lang.org/reference/i..., transmute (https://doc.rust-lang.org/std/mem/fn....,
panic_never crate (https://docs.rs/panic-never/latest/pa...)
Clippy lint (https://doc.rust-lang.org/clippy/lint...)

show more

Share/Embed