HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
Visualizing memory layout of Rust's data types

Sreekanth · Youtube · 31 HN points · 2 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention Sreekanth's video "Visualizing memory layout of Rust's data types".
Youtube Summary
Covers how a binary is executed, what segments are mapped to memory, the purpose/working of stack and heap memory, and how values of Rust's data types are laid out in memory. The data types that we cover here are integers, char, Vector, slice, String, string slice, structs, enums, smart pointers like Box, Rc, Arc, Trait object and Fn traits like FnOnce, FnMut and Fn.

We also cover the difference between String and str types, Vector and slice types. Topics like fat pointers, optimizations done by the Rust compiler when you wrap a reference inside an Option are also covered.

0:00 Segments in a binary
3:14 Stack & Heap
5:46 CPU Word size
7:08 Working of stack memory
10:25 working of Heap memory
14:00 Integer data types
14:30 char
15:15 size_of & align_of
15:51 Reference
16:58 Array
17:21 Vector
18:19 Slice of T
19:54 String, str, &str
21:17 Struct
22:14 Enum
24:14 Box pointer
24:51 Optimizations on Option
26:34 Copy Vs Move
29:21 Rc pointer
30:45 Send vs Sync traits
31:00 Why RC is neither Send nor Sync
31:24 Arc
32:19 Trait object
34:20 Function pointer
34:37 Closures

Life of an async fn: https://youtu.be/ZHP9sUqB3Qs
stack & heap / virtual address space:
https://lwn.net/Articles/738975/
https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/virtual-address-spaces
Book: Programming Rust by Jason Orendorff, Jim Blandy, and Leonora F.S. Tindall
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Sep 17, 2022 · sbdncuvh on Challenges for Rust
I had to learn some low level memory models before I could really grok rust. I understood a bit of C++ but it wasn't until I found the talk about memory structures for rust/c++ that I really caught on. I can understand why knowing existing programming techniques might cause a struggle.

https://youtu.be/rDoqT-a6UFg

Reading an entire book on C is probably overkill. This video is probably enough for most beginners: https://www.youtube.com/watch?v=rDoqT-a6UFg
intelijstupide
Wow thank's for that link. Bridged a few gaps for me between what I remember from c++ and what I've been learning in rustlings.
Oct 17, 2021 · 31 points, 1 comments · submitted by zackoverflow
neduma
+1
mlindner
Voice is too robotic to understand.
HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.