6#include "Templates/AlignmentTemplates.h"
58
59
60 virtual void*
Malloc( SIZE_T Size, uint32 Alignment )
override
62 check(Alignment <= ALLOCATION_ALIGNMENT &&
"Alignment currently unsupported in this allocator");
71 Ptr
->PreTag = (int32*) (AlignedPtr -
sizeof(int32));
78 check(GIsCriticalError||GFirstDebug->PrevLink==&GFirstDebug);
84 check(!(PTRINT(AlignedPtr) & ((PTRINT)0xf)));
89
90
91 virtual void*
Realloc(
void* InPtr, SIZE_T NewSize, uint32 Alignment )
override
93 if( InPtr && NewSize )
96 check(GIsCriticalError||(Ptr->RefCount==1));
97 void* Result =
Malloc( NewSize
, Alignment
);
98 FMemory::Memcpy( Result, InPtr, FMath::Min<SIZE_T>(Ptr->Size,NewSize) );
102 else if( InPtr ==
nullptr )
114
115
116 virtual void Free(
void* InPtr )
override
125 check(GIsCriticalError||Ptr->RefCount==1);
126 check(GIsCriticalError||*Ptr->PreTag==MEM_PreTag);
127 check(GIsCriticalError||*(int32*)((uint8*)InPtr+Ptr->Size)==MEM_PostTag);
136 check(GIsCriticalError||Ptr->PrevLink);
137 check(GIsCriticalError||*Ptr->PrevLink==Ptr);
148
149
150
151
152
153
170
171
172
173
182 Ar.Logf(
TEXT(
"" ) );
183 Ar.Logf(
TEXT(
"Unfreed memory:" ) );
186 Count += (int32)Ptr
->Size;
190 Ar.Logf(
TEXT(
"End of list: %i Bytes still allocated" ), Count );
191 Ar.Logf(
TEXT(
" %i Chunks allocated" ), Chunks );
195
196
201 check(GIsCriticalError||*(*Link)->PrevLink==*Link);
204 int32 Result = _heapchk();
205 check(Result!=_HEAPBADBEGIN);
206 check(Result!=_HEAPBADNODE);
207 check(Result!=_HEAPBADPTR);
208 check(Result!=_HEAPEMPTY);
209 check(Result==_HEAPOK);
static constexpr uint32 AllocatorOverhead
SIZE_T TotalAllocationSize
virtual void * Malloc(SIZE_T Size, uint32 Alignment) override
virtual bool ValidateHeap() override
virtual bool GetAllocationSize(void *Original, SIZE_T &SizeOut) override
virtual void * Realloc(void *InPtr, SIZE_T NewSize, uint32 Alignment) override
virtual bool Exec(UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar) override
virtual void Free(void *InPtr) override
virtual void DumpAllocatorStats(FOutputDevice &Ar) override
virtual const TCHAR * GetDescriptiveName() override
static FORCEINLINE void * Memset(void *Dest, uint8 Char, SIZE_T Count)