AuroraRuntime/Source/Memory/Memory.cpp

73 lines
1.6 KiB
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Memory.cpp
Date: 2021-6-12
Author: Reece
***/
2021-09-30 14:57:41 +00:00
#include <Source/RuntimeInternal.hpp>
2021-06-27 21:25:29 +00:00
#include "Memory.hpp"
#include <mimalloc.h>
#include <Source/HWInfo/HWInfo.hpp>
#if defined(AURORA_IS_LINUX_DERIVED)
#include <sys/mman.h>
#endif
2021-06-27 21:25:29 +00:00
namespace Aurora::Memory
{
AUKN_SYM AuUInt GetChunkSize(const void *head)
2021-06-27 21:25:29 +00:00
{
return mi_malloc_size(head);
}
AUKN_SYM void *_ZAlloc(Types::size_t length)
{
return mi_zalloc(length);
}
AUKN_SYM void *_ZAlloc(Types::size_t length, Types::size_t align)
{
return mi_zalloc_aligned(length, align);
}
AUKN_SYM void *_FAlloc(Types::size_t length)
{
return mi_malloc(length);
}
AUKN_SYM void *_FAlloc(Types::size_t length, Types::size_t align)
{
return mi_malloc_aligned(length, align);
}
AUKN_SYM void *_ZRealloc(void *buffer, Types::size_t length, Types::size_t align)
{
return mi_rezalloc_aligned(buffer, length, align);
}
AUKN_SYM void *_ZRealloc(void *buffer, Types::size_t length)
{
return mi_rezalloc(buffer, length);
}
AUKN_SYM void *_FRealloc(void *buffer, Types::size_t length, Types::size_t align)
{
return mi_realloc_aligned(buffer, length, align);
}
AUKN_SYM void *_FRealloc(void *buffer, Types::size_t length)
{
return mi_realloc(buffer, length);
}
AUKN_SYM void _Free(void *buffer)
{
mi_free(buffer);
}
AUKN_SYM AuUInt GetPageSize()
{
return AuHwInfo::GetPageSize();
}
2021-06-27 21:25:29 +00:00
}