diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 4ad6949d7..74d0ee85f 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -163,6 +163,19 @@ void PlatformBase::Exit() { } +void* PlatformBase::AllocatePages(uint64 numPages, uint64 pageSize) +{ + // Fallback to the default memory allocation + const uint64 numBytes = numPages * pageSize; + return Platform::Allocate(numBytes, pageSize); +} + +void PlatformBase::FreePages(void* ptr) +{ + // Fallback to free + Platform::Free(ptr); +} + PlatformType PlatformBase::GetPlatformType() { return PLATFORM_TYPE; diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index 188bad122..af282c614 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -322,13 +322,13 @@ public: /// The number of pages to allocate. /// The size of single page. Use Platform::GetCPUInfo().PageSize or provide compatible, custom size. /// The pointer to the allocated pages in memory. - static void* AllocatePages(uint64 numPages, uint64 pageSize) = delete; + static void* AllocatePages(uint64 numPages, uint64 pageSize); /// /// Frees allocated pages memory block. /// /// The pointer to the pages to deallocate. - static void FreePages(void* ptr) = delete; + static void FreePages(void* ptr); public: diff --git a/Source/Engine/Platform/Unix/UnixPlatform.cpp b/Source/Engine/Platform/Unix/UnixPlatform.cpp index cb734bfcd..42b788649 100644 --- a/Source/Engine/Platform/Unix/UnixPlatform.cpp +++ b/Source/Engine/Platform/Unix/UnixPlatform.cpp @@ -51,20 +51,6 @@ void UnixPlatform::Free(void* ptr) } } -void* UnixPlatform::AllocatePages(uint64 numPages, uint64 pageSize) -{ - const uint64 numBytes = numPages * pageSize; - - // Fallback to malloc - return malloc(numBytes); -} - -void UnixPlatform::FreePages(void* ptr) -{ - // Fallback to free - free(ptr); -} - uint64 UnixPlatform::GetCurrentProcessId() { return getpid(); diff --git a/Source/Engine/Platform/Unix/UnixPlatform.h b/Source/Engine/Platform/Unix/UnixPlatform.h index 12d4e5bc2..e0041c604 100644 --- a/Source/Engine/Platform/Unix/UnixPlatform.h +++ b/Source/Engine/Platform/Unix/UnixPlatform.h @@ -16,8 +16,6 @@ public: // [PlatformBase] static void* Allocate(uint64 size, uint64 alignment); static void Free(void* ptr); - static void* AllocatePages(uint64 numPages, uint64 pageSize); - static void FreePages(void* ptr); static uint64 GetCurrentProcessId(); };