Plasma Engine  2.0
Loading...
Searching...
No Matches
FrameAllocator.h
1#pragma once
2
3#include <Foundation/Memory/LinearAllocator.h>
4
6class PL_FOUNDATION_DLL plDoubleBufferedLinearAllocator
7{
8public:
9#if PL_ENABLED(PL_COMPILE_FOR_DEBUG)
10 static constexpr bool OverwriteMemoryOnReset = true;
11#else
12 static constexpr bool OverwriteMemoryOnReset = false;
13#endif
15
18
19 PL_ALWAYS_INLINE plAllocator* GetCurrentAllocator() const { return m_pCurrentAllocator; }
20
21 void Swap();
22 void Reset();
23
24private:
25 StackAllocatorType* m_pCurrentAllocator;
26 StackAllocatorType* m_pOtherAllocator;
27};
28
29class PL_FOUNDATION_DLL plFrameAllocator
30{
31public:
32 PL_ALWAYS_INLINE static plAllocator* GetCurrentAllocator() { return s_pAllocator->GetCurrentAllocator(); }
33
34 static void Swap();
35 static void Reset();
36
37private:
38 PL_MAKE_SUBSYSTEM_STARTUP_FRIEND(Foundation, FrameAllocator);
39
40 static void Startup();
41 static void Shutdown();
42
43 static plDoubleBufferedLinearAllocator* s_pAllocator;
44};
Base class for all memory allocators.
Definition Allocator.h:23
A double buffered stack allocator.
Definition FrameAllocator.h:7
Definition FrameAllocator.h:30
Definition LinearAllocator.h:12
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34