diff --git a/AK/kmalloc.h b/AK/kmalloc.h index c5a7a13e26f..6ef4caed0eb 100644 --- a/AK/kmalloc.h +++ b/AK/kmalloc.h @@ -52,6 +52,36 @@ # ifdef __serenity__ +inline void* operator new(size_t size) +{ + return kmalloc(size); +} + +inline void operator delete(void* ptr) +{ + return kfree(ptr); +} + +inline void operator delete(void* ptr, size_t) +{ + return kfree(ptr); +} + +inline void* operator new[](size_t size) +{ + return kmalloc(size); +} + +inline void operator delete[](void* ptr) +{ + return kfree(ptr); +} + +inline void operator delete[](void* ptr, size_t) +{ + return kfree(ptr); +} + inline void* operator new(size_t, void* ptr) { return ptr; diff --git a/Libraries/LibC/malloc.cpp b/Libraries/LibC/malloc.cpp index eb28a46d057..500788c89b8 100644 --- a/Libraries/LibC/malloc.cpp +++ b/Libraries/LibC/malloc.cpp @@ -439,33 +439,3 @@ void __malloc_init() new (&big_allocators()[0])(BigAllocator); } } - -void* operator new(size_t size) -{ - return malloc(size); -} - -void* operator new[](size_t size) -{ - return malloc(size); -} - -void operator delete(void* ptr) -{ - return free(ptr); -} - -void operator delete(void* ptr, size_t) -{ - return free(ptr); -} - -void operator delete[](void* ptr) -{ - return free(ptr); -} - -void operator delete[](void* ptr, size_t) -{ - return free(ptr); -}