diff --git a/src/sys/fs/block_device.rs b/src/sys/fs/block_device.rs index 20f1a84c..184eb86a 100644 --- a/src/sys/fs/block_device.rs +++ b/src/sys/fs/block_device.rs @@ -86,7 +86,7 @@ impl BlockDeviceIO for MemBlockDevice { } pub fn mount_mem() { - let mem = sys::mem::memory_size() / 2; // Half the allocatable memory + let mem = sys::mem::memory_free() / 2; let len = mem / super::BLOCK_SIZE; // TODO: take a size argument let dev = MemBlockDevice::new(len); *BLOCK_DEVICE.lock() = Some(BlockDevice::Mem(dev)); diff --git a/src/sys/mem/heap.rs b/src/sys/mem/heap.rs index eba0a42c..ba380c17 100644 --- a/src/sys/mem/heap.rs +++ b/src/sys/mem/heap.rs @@ -140,6 +140,8 @@ fn many_boxes() { #[test_case] fn large_vec() { + use alloc::vec::Vec; + let n = 1000; let mut vec = Vec::new(); for i in 0..n { diff --git a/src/sys/mem/mod.rs b/src/sys/mem/mod.rs index 4641604b..58b95cbf 100644 --- a/src/sys/mem/mod.rs +++ b/src/sys/mem/mod.rs @@ -83,7 +83,7 @@ pub fn memory_used() -> usize { } pub fn memory_free() -> usize { - (memory_size() - heap::heap_size()) + heap::heap_free() + heap::heap_free() } pub fn phys_to_virt(addr: PhysAddr) -> VirtAddr {