1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <cstdint> #include <cstddef> #pragma once typedef struct heap_block { std::uint32_t size; std::uint8_t is_free; struct heap_block* next; } heap_block_t; namespace memory { class heap { public: static void init(); static void free(void* ptr); static void* malloc(std::uint32_t size); static void lock(); static void unlock(); }; };