diff options
Diffstat (limited to 'src/allocator.h')
-rw-r--r-- | src/allocator.h | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/allocator.h b/src/allocator.h deleted file mode 100644 index 8a12be8..0000000 --- a/src/allocator.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include <types.h> - -class MemoryAllocator { -public: - MemoryAllocator(uint32_t start, size_t size); - - void* malloc(size_t size); - void free(void* ptr); - - size_t free_space() const; - size_t used_space() const; - -private: - struct MemoryChunk { - MemoryChunk* prev = nullptr; - MemoryChunk* next = nullptr; - bool allocated = false; - size_t size = 0; - }; - MemoryChunk* begin; -}; - -namespace std { -struct nothrow_t { - explicit nothrow_t() = default; -}; -}; // namespace std - -void* operator new(unsigned, const std::nothrow_t&) noexcept; -void* operator new[](unsigned, const std::nothrow_t&) noexcept; - -void operator delete(void* ptr); -void operator delete[](void* ptr); - -// placement new -void* operator new(unsigned, void*); -void* operator new[](unsigned, void*); |