Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/GenericPlatform
Inheritance Hierarchy
- FUseSystemMallocForNew
- FExec
- FMalloc
- FGenericPlatformMallocCrash
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMallocCrash.h |
| Include | #include "GenericPlatform/GenericPlatformMallocCrash.h" |
Syntax
struct FGenericPlatformMallocCrash : public FMalloc
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| uint8 * | BookkeepingPool | Preallocated memory pool for bookkeeping. | |
| uint32 | BookkeepingPoolOffset | Current position in the bookkeeping pool. | |
| uint32 | BookkeepingPoolSize | ||
| 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. | |
| uint32 | SmallMemoryPoolSize |
Constructors
| Type | Name | Description | |
|---|---|---|---|
FGenericPlatformMallocCrash
(
FMalloc* MainMalloc |
Destructors
| Type | Name | Description | |
|---|---|---|---|
Functions
| Type | Name | Description | |
|---|---|---|---|
| uint8 * | AllocateFromBookkeeping
(
uint32 AllocationSize |
||
| uint8 * | AllocateFromSmallPool
(
uint32 AllocationSize |
||
| uint32 | |||
| uint32 | |||
| FMallocCrashPool * | ChoosePoolForSize
(
uint32 AllocationSize |
Choose a pool to make a new allocation from of the given size - may use a larger pool than necessary if small pools are exhausted. | |
| FMallocCrashPool * | FindPoolForAlloc
(
void* Ptr |
Find the pool that an allocation was made from if any. | |
| FGenericPlatformMallocCrash & | Creates a new instance. | ||
| uint64 | GetAllocationSize
(
void* Original |
||
| const FPoolDesc & | GetPoolDesc
(
uint32 Index |
Generated by the FGenericPlatformMallocCrash::PrintPoolsUsage. | |
| void | |||
| bool | Whether it is safe to call crash malloc's methods. | ||
| bool | IsPtrInLargePool
(
void* Ptr |
||
| bool | IsPtrInSmallPool
(
void* Ptr |
||
| void | |||
| uint32 | SafePageSize () |
||
| void | SetAsGMalloc () |
Sets as GMalloc. |
Overridden from FMalloc
| Type | Name | Description | |
|---|---|---|---|
| void | Free
(
void* Original |
Free | |
| bool | GetAllocationSize
(
void* Original, |
If possible determine the size of the memory allocated at the given address | |
| const TCHAR * | Gets descriptive name for logging purposes. | ||
| bool | Returns if the allocator is guaranteed to be thread-safe and therefore doesn't need a unnecessary thread-safety wrapper around it. | ||
| void * | Malloc
(
SIZE_T Count, |
Malloc | |
| void * | Realloc
(
void* Original, |
Realloc | |
| bool | ValidateHeap () |
Validates the allocator's heap |
Constants
| Name | Description |
|---|---|
| LARGE_MEMORYPOOL_SIZE | |
| MAX_NUM_ALLOCS_IN_POOL | |
| MEM_TAG | |
| MEM_WIPETAG | |
| NUM_POOLS | |
| REQUIRED_ALIGNMENT |