diff --git a/kernel/src/memory/Heap.cpp b/kernel/src/memory/Heap.cpp index 6c7a4bad..1189b8dc 100644 --- a/kernel/src/memory/Heap.cpp +++ b/kernel/src/memory/Heap.cpp @@ -364,4 +364,34 @@ void dump_heap_usage() kdbgln("-- Total memory allocated for heap: %zu bytes", alloc_total); kdbgln("-- Heap memory in use by the kernel: %zu bytes", alloc_used); +} + +void* operator new(usize size) +{ + return kmalloc(size).expect_release_value("FIXME: Kernel new panics on OOM, since there are no exceptions"); +} + +void* operator new[](usize size) +{ + return kmalloc(size).expect_release_value("FIXME: Kernel new[] panics on OOM, since there are no exceptions"); +} + +void operator delete(void* p) +{ + kfree(p); +} + +void operator delete[](void* p) +{ + kfree(p); +} + +void operator delete(void* p, usize) +{ + kfree(p); +} + +void operator delete[](void* p, usize) +{ + kfree(p); } \ No newline at end of file