From: Evgeniy Filimonov <33426868+eugenefil@users.noreply.github.com> Date: Sun, 30 Jun 2024 16:23:20 +0000 (+0200) Subject: 07_threads: 03_leak: Leak vector with Vec::leak, not Box::leak (#107) X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=fccad089217810d6c048f17be40a263ec62a4abe;p=rust_exercises.git 07_threads: 03_leak: Leak vector with Vec::leak, not Box::leak (#107) --- diff --git a/book/src/07_threads/03_leak.md b/book/src/07_threads/03_leak.md index 824964b..a8795a6 100644 --- a/book/src/07_threads/03_leak.md +++ b/book/src/07_threads/03_leak.md @@ -27,12 +27,12 @@ run out and crash with an out-of-memory error. fn oom_trigger() { loop { let v: Vec = Vec::with_capacity(1024); - Box::leak(v); + v.leak(); } } ``` -At the same time, memory leaked via `Box::leak` is not truly forgotten.\ +At the same time, memory leaked via `leak` method is not truly forgotten.\ The operating system can map each memory region to the process responsible for it. When the process exits, the operating system will reclaim that memory.