1#include <Foundation/Memory/MemoryTracker.h>
2#include <Foundation/Memory/PageAllocator.h>
3#include <Foundation/System/SystemInformation.h>
4#include <Foundation/Time/Time.h>
7void* plPageAllocator::AllocatePage(
size_t uiSize)
13 const int res = posix_memalign(&ptr, uiAlign, uiSize);
14 PL_ASSERT_DEBUG(res == 0,
"Failed to align pointer");
15 PL_IGNORE_UNUSED(res);
17 PL_CHECK_ALIGNMENT(ptr, uiAlign);
19 if constexpr (plAllocatorTrackingMode::Default >= plAllocatorTrackingMode::AllocationStats)
21 plMemoryTracker::AddAllocation(plPageAllocator::GetId(), plAllocatorTrackingMode::Default, ptr, uiSize, uiAlign,
plTime::Now() - fAllocationTime);
28void plPageAllocator::DeallocatePage(
void* ptr)
30 if constexpr (plAllocatorTrackingMode::Default >= plAllocatorTrackingMode::AllocationStats)
32 plMemoryTracker::RemoveAllocation(plPageAllocator::GetId(), ptr);
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
static plTime Now()
Gets the current time.
Definition Time_Posix.h:12