Plasma Engine  2.0
Loading...
Searching...
No Matches
AllocPolicyGuarding.h
1#pragma once
2
3#include <Foundation/Containers/StaticRingBuffer.h>
4#include <Foundation/Math/Math.h>
5#include <Foundation/Threading/Lock.h>
6#include <Foundation/Threading/Mutex.h>
7
9{
10public:
12 PL_ALWAYS_INLINE ~plAllocPolicyGuarding() = default;
13
14 void* Allocate(size_t uiSize, size_t uiAlign);
15 void Deallocate(void* pPtr);
16
17 PL_ALWAYS_INLINE plAllocator* GetParent() const { return nullptr; }
18
19private:
20 plMutex m_Mutex;
21
22 plUInt32 m_uiPageSize;
23
24 plStaticRingBuffer<void*, (1 << 16)> m_AllocationsToFreeLater;
25};
Definition AllocPolicyGuarding.h:9
Base class for all memory allocators.
Definition Allocator.h:23
Provides a simple mechanism for mutual exclusion to prevent multiple threads from accessing a shared ...
Definition Mutex.h:13
A ring-buffer container that will use a static array of a given capacity to cycle through elements.
Definition StaticRingBuffer.h:10