Ark Server API (ASA) - Wiki
|
#include <GenericPlatformMallocCrash.h>
Public Types | |
enum | { LARGE_MEMORYPOOL_SIZE = 2 * 1024 * 1024 , REQUIRED_ALIGNMENT = 16 , NUM_POOLS = 14 , MAX_NUM_ALLOCS_IN_POOL = 2048 , MEM_TAG = 0xfe , MEM_WIPETAG = 0xcd } |
Static Public Member Functions | |
static FGenericPlatformMallocCrash & | Get (FMalloc *MainMalloc=nullptr) |
Protected Member Functions | |
bool | IsOnCrashedThread () const |
bool | IsPtrInLargePool (void *Ptr) const |
bool | IsPtrInSmallPool (void *Ptr) const |
const FPoolDesc & | GetPoolDesc (uint32 Index) const |
uint32 | CalculateSmallPoolTotalSize () const |
uint32 | CalculateBookkeepingPoolTotalSize () const |
void | InitializeSmallPools () |
FMallocCrashPool * | ChoosePoolForSize (uint32 AllocationSize) const |
FMallocCrashPool * | FindPoolForAlloc (void *Ptr) const |
uint8 * | AllocateFromBookkeeping (uint32 AllocationSize) |
uint8 * | AllocateFromSmallPool (uint32 AllocationSize) |
uint64 | GetAllocationSize (void *Original) |
Protected Member Functions inherited from FExec | |
virtual bool | Exec_Dev (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar) |
virtual bool | Exec_Editor (UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar) |
Static Protected Member Functions | |
static uint32 | SafePageSize () |
Protected Attributes | |
FCriticalSection | InternalLock |
int32 | CrashedThreadId = 0 |
uint8 * | LargeMemoryPool = nullptr |
uint32 | LargeMemoryPoolOffset = 0 |
uint8 * | SmallMemoryPool = nullptr |
uint32 | SmallMemoryPoolOffset = 0 |
uint32 | SmallMemoryPoolSize = 0 |
uint8 * | BookkeepingPool = nullptr |
uint32 | BookkeepingPoolOffset = 0 |
uint32 | BookkeepingPoolSize = 0 |
FMalloc * | PreviousMalloc = nullptr |
Friends | |
struct | FPoolDesc |
struct | FMallocCrashPool |
Additional Inherited Members | |
Static Public Attributes inherited from FMalloc | |
static TAtomic< uint64 > | MaxSingleAlloc |
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.
Definition at line 43 of file GenericPlatformMallocCrash.h.
Enumerator | |
---|---|
LARGE_MEMORYPOOL_SIZE | |
REQUIRED_ALIGNMENT | |
NUM_POOLS | |
MAX_NUM_ALLOCS_IN_POOL | |
MEM_TAG | |
MEM_WIPETAG |
Definition at line 48 of file GenericPlatformMallocCrash.h.
FGenericPlatformMallocCrash::FGenericPlatformMallocCrash | ( | FMalloc * | MainMalloc | ) |
|
virtual |
|
protected |
|
protected |
|
protected |
|
protected |
Free
Implements FMalloc.
|
static |
Creates a new instance.
|
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 |
Reimplemented from FMalloc.
Gets descriptive name for logging purposes.
Reimplemented from FMalloc.
Definition at line 100 of file GenericPlatformMallocCrash.h.
|
protected |
Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it.
Reimplemented from FMalloc.
Definition at line 89 of file GenericPlatformMallocCrash.h.
|
protected |
Whether it is safe to call crash malloc's methods.
|
overridevirtual |
Malloc
Implements FMalloc.
void FGenericPlatformMallocCrash::PrintPoolsUsage | ( | ) |
|
overridevirtual |
Realloc
Implements FMalloc.
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.
Validates the allocator's heap
Reimplemented from FMalloc.
Definition at line 94 of file GenericPlatformMallocCrash.h.
Definition at line 46 of file GenericPlatformMallocCrash.h.
Definition at line 45 of file GenericPlatformMallocCrash.h.
Preallocated memory pool for bookkeeping.
Definition at line 155 of file GenericPlatformMallocCrash.h.
|
protected |
Current position in the bookkeeping pool.
Definition at line 158 of file GenericPlatformMallocCrash.h.
|
protected |
Definition at line 159 of file GenericPlatformMallocCrash.h.
|
protected |
The id of the thread that crashed.
Definition at line 139 of file GenericPlatformMallocCrash.h.
|
protected |
Used to lock crash malloc to one thread.
Definition at line 136 of file GenericPlatformMallocCrash.h.
Preallocated memory pool for large allocations.
Definition at line 142 of file GenericPlatformMallocCrash.h.
|
protected |
Current position in the large memory pool.
Definition at line 145 of file GenericPlatformMallocCrash.h.
Previously used malloc.
Definition at line 162 of file GenericPlatformMallocCrash.h.
Preallocated memory pool for small allocations.
Definition at line 148 of file GenericPlatformMallocCrash.h.
|
protected |
Current position in the small memory pool.
Definition at line 151 of file GenericPlatformMallocCrash.h.
|
protected |
Definition at line 152 of file GenericPlatformMallocCrash.h.