FMemory

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/HAL/UnrealMemory.h

Include

#include "HAL/UnrealMemory.h"

Syntax

struct FMemory

Functions

Name Description

Public function Static

void *

 

BigBlockMemcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Public function Static

void

 

ClearAndDisableTLSCachesOnCurrentThread()

Clears the TLS caches on the current thread and disables any future caching.

Public function Static

void

 

DisablePersistentAuxiliary()

Public function Static

void

 

EnablePersistentAuxiliary()

Public function Static

void

 

EnablePoisonTests()

Called once main is started and we have -purgatorymallocproxy.

Public function Static

void

 

EnablePurgatoryTests()

Called once main is started and we have -purgatorymallocproxy.

Public function Static

void

 

ExplicitInit

(
    FMalloc& Allocator
)

Set global allocator instead of creating it lazily on first allocation.

Public function Static

void

 

Free

(
    void* Original
)

Public function Static

void

 

FreePersistentAuxiliary

(
    void* InPtr
)

Public function Static

SIZE_T

 

GetAllocSize

(
    void* Original
)

Public function Static

SIZE_T

 

GetUsedPersistentAuxiliary()

Public function Static

bool

 

IsPersistentAuxiliaryActive()

Public function Static

void *

 

Malloc

(
    SIZE_T Count,
    uint32 Alignment
)

C style memory allocation stubs.

Public function Static

void *

 

MallocPersistentAuxiliary

(
    SIZE_T InSize,
    uint32 InAlignment
)

Public function Static

void *

 

MallocZeroed

(
    SIZE_T Count,
    uint32 Alignment
)

Public function Static

int32

 

Memcmp

(
    const void* Buf1,
    const void* Buf2,
    SIZE_T Count
)

Public function Static

void *

 

Memcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Public function Static

void

 

Memcpy

(
    T& Dest,
    const T& Src
)

Public function Static

void *

 

Memmove

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Public function Static

void

 

Memset

(
    T& Src,
    uint8 ValueToSet
)

Public function Static

void *

 

Memset

(
    void* Dest,
    uint8 Char,
    SIZE_T Count
)

Public function Static

void

 

Memswap

(
    void* Ptr1,
    void* Ptr2,
    SIZE_T Size
)

Public function Static

void

 

Memzero

(
    T& Src
)

Public function Static

void *

 

Memzero

(
    void* Dest,
    SIZE_T Count
)

Public function Static

void *

 

ParallelMemcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count,
    EMemcpyCachePolicy Policy
)

Public function Static

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.

Public function Static

void *

 

Realloc

(
    void* Original,
    SIZE_T Count,
    uint32 Alignment
)

Public function Static

void

 

RegisterPersistentAuxiliary

(
    void* InMemory,
    SIZE_T InSize
)

Functions to handle special memory given to the title from the platform This memory is allocated like a stack, it's never really freed

Public function Static

void

 

SetupTLSCachesOnCurrentThread()

Set up TLS caches on the current thread. These are the threads that we can trim.

Public function Static

void *

 

StreamingMemcpy

(
    void* Dest,
    const void* Src,
    SIZE_T Count
)

Public function Static

void

 

SystemFree

(
    void* Ptr
)

Public function Static

void *

 

SystemMalloc

(
    SIZE_T Size
)

C style memory allocation stubs that fall back to C runtime

Public function Static

void

 

TestMemory()

A helper function that will perform a series of random heap allocations to test the internal validity of the heap.

Public function Static

void

 

Trim

(
    bool bTrimThreadCaches
)

Releases as much memory as possible. Must be called from the main thread.

Enums

Name

Description

Public enum

AllocationHints

Some allocators can be given hints to treat allocations differently depending on how the memory is used, it's lifetime etc.