engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Protected 成员函数 | 静态 Protected 成员函数 | Protected 属性 | 所有成员列表
FGenericPlatformMallocCrash结构体 参考final

Simple pooled memory allocator that uses preallocated memory. 更多...

#include <GenericPlatformMallocCrash.h>

+ 类 FGenericPlatformMallocCrash 继承关系图:

Public 成员函数

virtual void Free (void *) override
 Free
 
virtual bool GetAllocationSize (void *Original, SIZE_T &SizeOut) override
 If possible determine the size of the memory allocated at the given address 更多...
 
virtual const TCHAR * GetDescriptiveName () override
 Gets descriptive name for logging purposes. 更多...
 
virtual bool IsInternallyThreadSafe () const override
 Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it.
 
virtual void * Malloc (SIZE_T Size, uint32 Alignment) override
 Malloc
 
virtual void * Realloc (void *Ptr, SIZE_T NewSize, uint32 Alignment) override
 Realloc
 
void SetAsGMalloc ()
 Sets as GMalloc. 更多...
 
virtual bool ValidateHeap () override
 Validates the allocator's heap
 
- Public 成员函数 继承自 FMalloc
virtual void ClearAndDisableTLSCachesOnCurrentThread ()
 Clears the TLS caches on the current thread and disables any future caching.
 
virtual void DumpAllocatorStats (class FOutputDevice &Ar)
 Dumps current allocator stats to the log.
 
virtual bool Exec (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar) override
 Handles any commands passed in on the command line
 
virtual void Free (void *Original)=0
 Free
 
virtual bool GetAllocationSize (void *Original, SIZE_T &SizeOut)
 If possible determine the size of the memory allocated at the given address 更多...
 
virtual void GetAllocatorStats (FGenericMemoryStats &out_Stats)
 Writes allocator stats from the last update into the specified destination.
 
virtual const TCHAR * GetDescriptiveName ()
 Gets descriptive name for logging purposes. 更多...
 
virtual void InitializeStatsMetadata ()
 Initializes stats metadata. 更多...
 
virtual bool IsInternallyThreadSafe () const
 Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it.
 
virtual void * Malloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
 Malloc
 
virtual SIZE_T QuantizeSize (SIZE_T Count, uint32 Alignment)
 For some allocators this will return the actual size that should be requested to eliminate internal fragmentation. 更多...
 
virtual void * Realloc (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)=0
 Realloc
 
virtual void SetupTLSCachesOnCurrentThread ()
 Set up TLS caches on the current thread. 更多...
 
virtual void Trim (bool bTrimThreadCaches)
 Releases as much memory as possible. 更多...
 
virtual void * TryMalloc (SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 TryMalloc - like Malloc(), but may return a nullptr result if the allocation request cannot be satisfied.
 
virtual void * TryRealloc (void *Original, SIZE_T Count, uint32 Alignment=DEFAULT_ALIGNMENT)
 TryRealloc - like Realloc(), but may return a nullptr if the allocation request cannot be satisfied. 更多...
 
virtual void UpdateStats ()
 Called once per frame, gathers and sets all memory allocator statistics into the corresponding stats. 更多...
 
virtual bool ValidateHeap ()
 Validates the allocator's heap
 
- Public 成员函数 继承自 FUseSystemMallocForNew
void operator delete (void *Ptr)
 Overloaded delete operator using the system allocator 更多...
 
void operator delete[] (void *Ptr)
 Overloaded array delete operator using the system allocator 更多...
 
void * operator new (size_t Size)
 Overloaded new operator using the system allocator. 更多...
 
void * operator new[] (size_t Size)
 Overloaded array new operator using the system allocator. 更多...
 

静态 Public 成员函数

static CORE_API FGenericPlatformMallocCrash & Get (FMalloc *MainMalloc=nullptr)
 Creates a new instance.
 

Protected 成员函数

bool IsOnCrashedThread () const
 Whether it is safe to call crash malloc's methods.
 

静态 Protected 成员函数

static uint32 SafePageSize ()
 

Protected 属性

int32 CrashedThreadId
 The id of the thread that crashed.
 
FCriticalSection InternalLock
 Used to lock crash malloc to one thread.
 
uint8 * LargeMemoryPool
 Preallocated memory pool for large allocations.
 
uint32 LargeMemoryPoolOffset
 Current position in the large memory pool.
 
FMalloc * PreviousMalloc
 Previously used malloc.
 
uint8 * SmallMemoryPool
 Preallocated memory pool for small allocations.
 
uint32 SmallMemoryPoolOffset
 Current position in the small memory pool.
 

额外继承的成员函数

- 静态 Public 属性 继承自 FMalloc
static TAtomic< uint64 > MaxSingleAlloc
 Limits the maximum single allocation, to this many bytes, for debugging
 

详细描述

Simple pooled memory allocator that uses preallocated memory.

Instance of this class replaces GMalloc after a crash, so we can use dynamic memory allocation even if the app crashes due to OOM.

成员函数说明

◆ GetAllocationSize()

virtual bool FGenericPlatformMallocCrash::GetAllocationSize ( void *  Original,
SIZE_T &  SizeOut 
)
overridevirtual

If possible determine the size of the memory allocated at the given address

参数
Original- Pointer to memory we are checking the size of
SizeOut- If possible, this value is set to the size of the passed in pointer
返回
true if succeeded

重载 FMalloc .

◆ GetDescriptiveName()

virtual const TCHAR * FGenericPlatformMallocCrash::GetDescriptiveName ( )
inlineoverridevirtual

Gets descriptive name for logging purposes.

返回
pointer to human-readable malloc name

重载 FMalloc .

◆ SafePageSize()

static uint32 FGenericPlatformMallocCrash::SafePageSize ( )
staticprotected
返回
page size, if page size is not initialized, returns 64k.

◆ SetAsGMalloc()

void FGenericPlatformMallocCrash::SetAsGMalloc ( )

Sets as GMalloc.

This method locks to the thread that crashed. Any next calls to this method or GMalloc from other threads will dead-lock those threads, but this is ok, because we are shutting down. This also fixes a lot of potential issues of using dynamic allocation during crash dumping.

警告
This is not super safe, may interfere with other allocations, ie. replacing vtable during running the code from the previous malloc will probably crash other threads.

该结构体的文档由以下文件生成: