TryCollectGarbage

Performs garbage collection only if no other thread holds a lock on GC

Choose your operating system:

Windows

macOS

Linux

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/UObjectGlobals.h

Include

#include "UObject/UObjectGlobals.h"

Source

/Engine/Source/Runtime/CoreUObject/Private/UObject/GarbageCollection.cpp

Syntax

bool TryCollectGarbage
(
    EObjectFlags KeepFlags,
    bool bPerformFullPurge
)

Remarks

Performs garbage collection only if no other thread holds a lock on GC

Parameters

Parameter

Description

KeepFlags

objects with those flags will be kept regardless of being referenced or not

bPerformFullPurge

if true, perform a full purge after the mark pass