/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/Memory/Implementation/TempAllocator.cpp
46 строк
1 KB
C-Core
Temp allocator (#1860)
10 мар 2026, 18:19
Не верифицирован
10 мар 2026, 18:19
8b61066
Код
Авторство
О чём код?
#include <Foundation/FoundationPCH.h> #include <Foundation/Configuration/Startup.h> #include <Foundation/Memory/AllocatorWithPolicy.h> #include <Foundation/Memory/Policies/AllocPolicyStack.h> #include <Foundation/Memory/TempAllocator.h> // clang-format off EZ_BEGIN_SUBSYSTEM_DECLARATION(Foundation, TempAllocator) ON_CORESYSTEMS_STARTUP { ezTempAllocator::Startup(); } ON_CORESYSTEMS_SHUTDOWN { ezTempAllocator::Shutdown(); } EZ_END_SUBSYSTEM_DECLARATION; // clang-format on ezAllocator* ezTempAllocator::s_pAllocator; // static void ezTempAllocator::Startup() { #if EZ_ENABLED(EZ_COMPILE_FOR_DEBUG) static constexpr bool OverwriteMemoryOnFree = true; #else static constexpr bool OverwriteMemoryOnFree = false; #endif using StackAllocatorType = ezAllocatorWithPolicy<ezAllocPolicyStack<OverwriteMemoryOnFree>, ezAllocatorTrackingMode::Basics>; s_pAllocator = EZ_DEFAULT_NEW(StackAllocatorType, "TempAllocator", ezFoundation::GetAlignedAllocator()); } // static void ezTempAllocator::Shutdown() { EZ_DEFAULT_DELETE(s_pAllocator); } EZ_STATICLINK_FILE(Foundation, Foundation_Memory_Implementation_TempAllocator);