Why does this Rust program leak memory? @fasterthanlime
Why does this Rust program leak memory?  @fasterthanlime
Uploaded February 2023 | Updated September 2026, 3 weeks ago
Follow me on Mastodon: hachyderm.io/@fasterthanlime
Support my work: fasterthanli.me/donate

Thanks to Omer from Egypt for submitting this question: github.com/mariocynicys/mem-hog
Submit your own questions: fasterthanli.me/submit

Making our own executable packer: fasterthanli.me/series/making-our-own-executable-packer

Contents
00:00 What does the program do?
04:35 Memory usage, Vec, and jemalloc
06:18 How does malloc even work?
07:22 Visualizing allocations with memusage
11:14 Where is the heap? /proc/PID/maps
14:24 Virtual memory vs RSS
16:00 Tracing syscalls with strace
19:50 Virtual memory vs physical memory
20:50 The madvise syscall
22:31 What's technique 2 doing?
23:37 Iterator size hints
24:56 What's technique 3 doing?
30:31 Mystery solved
34:53 Thanks & outro
Why does this Rust program leak memory?The thing inside the thingGetting good at SNES games through DLL injectionForcing rustfmt to break codeThe virtue of unsynnHow does the detour crate work?Catching up with async RustLets make an htop-like in your browser (with Rust)AoC Day 19, Rewrite it in Rust EditionI ported h2spec to Rust (also: codegen!)strace feels like magic — let’s fix that (with Rust)I bought us a Zed feature with cookies
fasterthanlime |

Why does this Rust program leak memory?

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER