From 22675cd8dc75d8b8d4b0f818f5b093efbc364802 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Fri, 8 Aug 2025 22:44:15 +0200 Subject: vault backup: 2025-08-08 22:44:15 --- Boxes live in the heap.md | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 Boxes live in the heap.md (limited to 'Boxes live in the heap.md') diff --git a/Boxes live in the heap.md b/Boxes live in the heap.md deleted file mode 100644 index ec296c9..0000000 --- a/Boxes live in the heap.md +++ /dev/null @@ -1,15 +0,0 @@ -[[Rust]] -[[Variables lives in the stack]] -[[When boxes are deallocated]] -[[Ownership]] - ---- - -The heap is where data can live indefinitely and we can create pointers to it on the stack using a Box. - -```rust -let a = Box::new([0; 1_000_000]); -let b = a; -``` - -Creates an array with 1 million entries on the heap and two variables on the stack that point to it. \ No newline at end of file -- cgit v1.2.3