mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 22:53:34 +00:00
working on garbage collection, fixing small issues with font destroy
This commit is contained in:
@@ -11,7 +11,9 @@ namespace mlx
|
||||
static void* Malloc(std::size_t size);
|
||||
static void* AlignedMalloc(std::size_t alignment, std::size_t size);
|
||||
static void* Calloc(std::size_t n, std::size_t size);
|
||||
static void* AlignedCalloc(std::size_t alignment, std::size_t n, std::size_t size);
|
||||
static void* Realloc(void* ptr, std::size_t size);
|
||||
static void* AlignedRealloc(void* ptr, std::size_t alignment, std::size_t size);
|
||||
static void Free(void* ptr);
|
||||
|
||||
inline static bool IsInit() noexcept { return s_instance != nullptr; }
|
||||
@@ -19,9 +21,19 @@ namespace mlx
|
||||
|
||||
~MemManager();
|
||||
|
||||
private:
|
||||
struct Descriptor
|
||||
{
|
||||
void* ptr;
|
||||
std::size_t size;
|
||||
bool aligned;
|
||||
|
||||
Descriptor(void* ptr, std::size_t size, bool aligned) : ptr(ptr), size(size), aligned(aligned) {}
|
||||
};
|
||||
|
||||
private:
|
||||
static MemManager* s_instance;
|
||||
inline static std::vector<void*> s_blocks;
|
||||
inline static std::vector<Descriptor> s_blocks;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user