mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Add image alt text
This commit is contained in:
@@ -680,7 +680,17 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
||||
|
||||
When we run it now, we see the following:
|
||||
|
||||

|
||||

|
||||
|
||||
As expected, we see that the `Box` and `Vec` values live on the heap, as indicated by the pointer starting with `0x_4444_4444`. The reason that the vector starts at offset `0x800` is not that the boxed value is `0x800` bytes large, but the [reallocations] that occur when the vector needs to increase its capacity. For example, when the vectors capacity is 32 and we try to add the next element, the vector allocates a new backing array with capacity 64 behind the scenes and copies all elements over. Then it frees the old allocation, which in our case is equivalent to leaking it since our bump allocator doesn't reuse freed memory.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user