本文整理汇总了C++中UObject::IsSafeForRootSet方法的典型用法代码示例。如果您正苦于以下问题:C++ UObject::IsSafeForRootSet方法的具体用法?C++ UObject::IsSafeForRootSet怎么用?C++ UObject::IsSafeForRootSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UObject
的用法示例。
在下文中一共展示了UObject::IsSafeForRootSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CloseDisregardForGC
void FUObjectArray::CloseDisregardForGC()
{
check(IsInGameThread());
check(OpenForDisregardForGC);
// Iterate over all class objects and force the default objects to be created. Additionally also
// assembles the token reference stream at this point. This is required for class objects that are
// not taken into account for garbage collection but have instances that are.
// Workaround for Visual Studio 2013 analyzer bug. Using a temporary directly in the range-for
// errors if the analyzer is enabled.
TObjectRange<UClass> Range;
for (UClass* Class : Range)
{
// Force the default object to be created.
Class->GetDefaultObject(); // Force the default object to be constructed if it isn't already
// Assemble reference token stream for garbage collection/ RTGC.
if (!Class->HasAnyClassFlags(CLASS_TokenStreamAssembled))
{
Class->AssembleReferenceTokenStream();
}
}
if (GIsInitialLoad)
{
// Iterate over all objects and mark them to be part of root set.
int32 NumAlwaysLoadedObjects = 0;
int32 NumRootObjects = 0;
for (FObjectIterator It; It; ++It)
{
UObject* Object = *It;
if (Object->IsSafeForRootSet())
{
NumRootObjects++;
Object->AddToRoot();
}
else if (Object->IsRooted())
{
Object->RemoveFromRoot();
}
NumAlwaysLoadedObjects++;
}
UE_LOG(LogUObjectArray, Log, TEXT("%i objects as part of root set at end of initial load."), NumAlwaysLoadedObjects);
if (GUObjectArray.DisregardForGCEnabled())
{
UE_LOG(LogUObjectArray, Log, TEXT("%i objects are not in the root set, but can never be destroyed because they are in the DisregardForGC set."), NumAlwaysLoadedObjects - NumRootObjects);
}
// When disregard for GC pool is closed for the first time, make sure the first GC index is set after the last non-GC index.
// We do allow here for some slack if MaxObjectsNotConsideredByGC > (ObjLastNonGCIndex + 1) so that disregard for GC pool
// can be re-opened later.
ObjFirstGCIndex = FMath::Max(ObjFirstGCIndex, ObjLastNonGCIndex + 1);
GUObjectAllocator.BootMessage();
}
UE_LOG(LogUObjectArray, Log, TEXT("CloseDisregardForGC: %d/%d objects in disregard for GC pool"), ObjLastNonGCIndex + 1, MaxObjectsNotConsideredByGC);
OpenForDisregardForGC = false;
GIsInitialLoad = false;
}