UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GarbageCollection.h File Reference

Go to the source code of this file.

Classes

class  UE::GC::FSchemaOwner
 
class  FGCScopeGuard
 
class  FGCScopeTryGuard
 
struct  FGarbageReferenceInfo
 
union  FGarbageReferenceInfo::FReferencerUnion
 
struct  FGCDirectReference
 

Namespaces

namespace  UE
 
namespace  UE::GC
 
namespace  UE::GC::Private
 

Macros

#define GARBAGE_COLLECTION_KEEPFLAGS   (GIsEditor ? RF_Standalone : RF_NoFlags)
 
#define ENABLE_GC_OBJECT_CHECKS   (!(UE_BUILD_TEST || UE_BUILD_SHIPPING) || 0)
 
#define ENABLE_GC_HISTORY   (!UE_BUILD_SHIPPING)
 
#define DO_POINTER_CHECKS_ON_GC   0
 

Enumerations

enum class  UE::GC::EAROFlags { UE::GC::None = 0 , UE::GC::Unbalanced = 1 << 0 , UE::GC::ExtraSlow = 2 << 0 }
 

Functions

COREUOBJECT_API DECLARE_LOG_CATEGORY_EXTERN (LogGarbage, Warning, All)
 
 DECLARE_STATS_GROUP (TEXT("Garbage Collection"), STATGROUP_GC, STATCAT_Advanced)
 
 UE::GC::ENUM_CLASS_FLAGS (EAROFlags)
 
void UE::GC::RegisterSlowImplementation (ObjectAROFn ARO, EAROFlags Flags)
 
COREUOBJECT_API TSAN_ATOMIC (bool) GIsGarbageCollecting
 
COREUOBJECT_API double GetLastGCTime ()
 
COREUOBJECT_API double GetLastGCDuration ()
 
UE_FORCEINLINE_HINT bool IsGarbageCollecting ()
 
COREUOBJECT_API bool IsGarbageCollectingAndLockingUObjectHashTables ()
 
void UE::GC::Private::SetSkipDestroy (bool bSkip)
 

Macro Definition Documentation

◆ DO_POINTER_CHECKS_ON_GC

#define DO_POINTER_CHECKS_ON_GC   0

Do extra checks on GC'd function references to catch uninitialized pointers? These checks are possibly producing false positives now that our memory use is going over 128Gb = 2^39.

◆ ENABLE_GC_HISTORY

#define ENABLE_GC_HISTORY   (!UE_BUILD_SHIPPING)

◆ ENABLE_GC_OBJECT_CHECKS

#define ENABLE_GC_OBJECT_CHECKS   (!(UE_BUILD_TEST || UE_BUILD_SHIPPING) || 0)

UObject pointer checks are disabled by default in shipping and test builds as they add roughly 20% overhead to GC times

◆ GARBAGE_COLLECTION_KEEPFLAGS

#define GARBAGE_COLLECTION_KEEPFLAGS   (GIsEditor ? RF_Standalone : RF_NoFlags)

Context sensitive keep flags for garbage collection

Function Documentation

◆ DECLARE_LOG_CATEGORY_EXTERN()

COREUOBJECT_API DECLARE_LOG_CATEGORY_EXTERN ( LogGarbage  ,
Warning  ,
All   
)

◆ DECLARE_STATS_GROUP()

DECLARE_STATS_GROUP ( TEXT("Garbage Collection" ,
STATGROUP_GC  ,
STATCAT_Advanced   
)

◆ GetLastGCDuration()

COREUOBJECT_API double GetLastGCDuration ( )

Gets the duration of the last GC run.

Returns
Returns the last GC duration, -1 if GC has never run.

◆ GetLastGCTime()

COREUOBJECT_API double GetLastGCTime ( )

Gets the last time that the GC was run.

Returns
Returns the FPlatformTime::Seconds() for the last garbage collection, 0 if GC has never run.

◆ IsGarbageCollecting()

UE_FORCEINLINE_HINT bool IsGarbageCollecting ( )

Whether we are inside garbage collection

◆ IsGarbageCollectingAndLockingUObjectHashTables()

COREUOBJECT_API bool IsGarbageCollectingAndLockingUObjectHashTables ( )

Whether garbage collection is locking the global uobject hash tables

◆ TSAN_ATOMIC()

COREUOBJECT_API TSAN_ATOMIC ( bool  )
extern

True if Garbage Collection is running. Use IsGarbageCollecting() functio n instead of using this variable directly