![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <GCObject.h>
Inheritance diagram for FGCObject:Public Types | |
| enum class | EFlags : uint32 { None = 0 , RegisterLater = 1 << 0 , AddStableNativeReferencesOnly = 1 << 1 } |
Public Member Functions | |
| FGCObject () | |
| FGCObject (const FGCObject &Other) | |
| FGCObject (FGCObject &&Other) | |
| FGCObject (EFlags Flags) | |
| virtual | ~FGCObject () |
| FGCObject & | operator= (const FGCObject &) |
| FGCObject & | operator= (FGCObject &&) |
| COREUOBJECT_API void | RegisterGCObject () |
| COREUOBJECT_API void | UnregisterGCObject () |
| virtual void | AddReferencedObjects (FReferenceCollector &Collector)=0 |
| virtual FString | GetReferencerName () const =0 |
| virtual bool | GetReferencerPropertyName (UObject *Object, FString &OutPropertyName) const |
Static Public Member Functions | |
| static COREUOBJECT_API void | StaticInit () |
Static Public Attributes | |
| static COREUOBJECT_API UGCObjectReferencer * | GGCObjectReferencer = nullptr |
This class provides common registration for garbage collection for non-UObject classes. It is an abstract base class requiring you to implement the AddReferencedObjects() method.
Note: FGCObject instances are not trivially relocatable, and are therefore not suited for being stored in Unreal container types by value. For example, this won't work: class FMyClass : public FGCObject {}; struct FSomeStruct { TArray<FMyClass> Instances; // Storing anything here might crash GC at // reachability analysis };
|
strong |
| Enumerator | |
|---|---|
| None | |
| RegisterLater | Manually call RegisterGCObject() later to avoid collecting references from empty / late-initialized FGCObjects |
| AddStableNativeReferencesOnly | Declare that AddReferencedObjects only calls FReferenceCollector::AddStableReference*() functions instead of the older FReferenceCollector::AddReferenceObject*() and only adds native references. Allows gathering initial references before reachability analysis starts. |
|
inline |
Tells the global object that forwards AddReferencedObjects calls on to objects that a new object is requiring AddReferencedObjects call.
|
inline |
|
inline |
|
inlineexplicit |
|
inlinevirtual |
|
pure virtual |
Pure virtual that must be overloaded by the inheriting class. Use this method to serialize any UObjects contained that you wish to keep around.
| Collector | The collector of referenced objects. |
Implemented in Audio::FMixerDevice, Audio::FSoundSourceDecoder, FARSupportInterface, FAsyncPackage, PackageReloadInternal::FExistingPackageReferences, PackageReloadInternal::FNewPackageReferences, ConstructorHelpers::FObjectFinder< T >, ConstructorHelpers::FObjectFinderOptional< T >, ConstructorHelpers::FClassFinder< T >, TGCObjectScopeGuard< ObjectType >, TGCObjectsScopeGuard< ObjectType >, FStreamableManager, FParticleSystemWorldManager, Audio::FSoundWavePCMLoader, FTextRenderComponentMIDCache, FChaosDerivedDataCookerRefHolder, FPendingStreamingLevelHolder, FSMInstanceElementIdMap, FRepLayout, FPreviewScene, FDebugCanvasDrawer, FDeferredCleanupSlateBrush, FSlateGameResources, FSubsystemCollection< TBaseType >, FSubsystemCollection< UAudioEngineSubsystem >, FViewport::FHitProxyMap, UE::Dataflow::FContextAssetStore, UE::Dataflow::TContextCacheElementUObject< T >, UE::Dataflow::TContextCacheElementUObjectArray< T >, UE::Dataflow::FContextCacheElementUStruct, UE::Dataflow::FContextCacheElementUStructArray, UE::Interchange::FImportResult, UE::Interchange::FImportAsyncHelper, FMassEntityManager, FMassProcessingPhaseManager, FPreLoadSettingsContainerBase, FLegacySlateFontInfoCache, FSlateInvalidationRoot, FStandaloneCompositeFont, FSlateDrawBuffer, FRetainerWidgetRenderingResources, SMeshWidget, FUMGDragDropOp, UE::UniversalObjectLocator::FRegistry, FDefaultWebBrowserAdapter, and FWebJSScripting.
|
pure virtual |
Overload this method to report a name for your referencer
Implemented in PackageReloadInternal::FExistingPackageReferences, PackageReloadInternal::FNewPackageReferences, FSlateDrawBuffer, Audio::FMixerDevice, Audio::FSoundSourceDecoder, FARSupportInterface, FAsyncPackage, ConstructorHelpers::FObjectFinder< T >, ConstructorHelpers::FObjectFinderOptional< T >, ConstructorHelpers::FClassFinder< T >, TGCObjectScopeGuard< ObjectType >, TGCObjectsScopeGuard< ObjectType >, FStreamableManager, FParticleSystemWorldManager, Audio::FSoundWavePCMLoader, FTextRenderComponentMIDCache, FChaosDerivedDataCookerRefHolder, FPendingStreamingLevelHolder, FSMInstanceElementIdMap, FRepLayout, FPreviewScene, FDebugCanvasDrawer, FDeferredCleanupSlateBrush, FSlateGameResources, FSubsystemCollection< TBaseType >, FSubsystemCollection< UAudioEngineSubsystem >, FViewport::FHitProxyMap, UE::Dataflow::FContextAssetStore, UE::Dataflow::TContextCacheElementUObject< T >, UE::Dataflow::TContextCacheElementUObjectArray< T >, UE::Dataflow::FContextCacheElementUStruct, UE::Dataflow::FContextCacheElementUStructArray, UE::Interchange::FImportResult, UE::Interchange::FImportAsyncHelper, FMassEntityManager, FMassProcessingPhaseManager, FPreLoadSettingsContainerBase, FLegacySlateFontInfoCache, FSlateInvalidationRoot, FStandaloneCompositeFont, FRetainerWidgetRenderingResources, SMeshWidget, FUMGDragDropOp, UE::UniversalObjectLocator::FRegistry, FDefaultWebBrowserAdapter, and FWebJSScripting.
|
inlinevirtual |
Overload this method to report how the specified object is referenced, if necessary
Reimplemented in FStreamableManager.
| void FGCObject::RegisterGCObject | ( | ) |
Register with GC, only needed if constructed with EFlags::RegisterLater or after unregistering
|
static |
Initializes the global object referencer and adds it to the root set.
| void FGCObject::UnregisterGCObject | ( | ) |
Unregister ahead of destruction. Safe to call multiple times.
|
static |
The static object referencer object that is shared across all garbage collectible non-UObject objects.