Async Allocators
A deep dive into the potential benefits, and awkward drawbacks, by making all allocations async and fallible Visit https://sdr-podcast.com/episodes/async-allocators/sdr-podcast.com/episodes/async-allocators/ 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=sdr-pod CodeCrafters 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=sdr-pod - Eliza Weisman https://www.elizas.website/ - malloc and free https://en.wikipedia.org/wiki/Memory_management#Manual_memory_management - `GlobalAlloc` https://doc.rust-lang.org/std/alloc/trait.GlobalAlloc.html, Functions `alloc` https://doc.rust-lang.org/std/alloc/fn.alloc.html & `dealloc` https://doc.rust-lang.org/std/alloc/fn.dealloc.html - Allocator https://doc.rust-lang.org/std/alloc/trait.Allocator.html trait, NonNull https://doc.rust-lang.org/std/ptr/struct.NonNull.html - MMU: Memory management unit https://en.wikipedia.org/wiki/Memory_management_unit - Mnemos https://mnemos.dev/mnemosprojectoverview/ - drop https://doc.rust-lang.org/std/mem/fn.drop.htmlz - intrusive linked lists https://www.data-structures-in-practice.com/intrusive-linked-lists/ - destructors https://doc.rust-lang.org/reference/destructors.html - tokio https://tokio.rs/ an asynchronous runtime for Rust - Vec https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.from_raw_parts, HashMap https://doc.rust-lang.org/stable/std/collections/hash_map/struct.HashMap.html, Box https://doc.rust-lang.org/stable/std/boxed/struct.Box.html and Arc https://doc.rust-lang.org/stable/std/sync/struct.Arc.html - Miri https://github.com/rust-lang/miri, union https://doc.rust-lang.org/reference/items/unions.html, transmute https://doc.rust-lang.org/std/mem/fn.transmute.html, - panic_never crate https://docs.rs/panic-never/latest/panic_never/ - Clippy lint https://doc.rust-lang.org/clippy/lints.html
Download
0 formatsNo download links available.