r.ISMPool.ComponentFreeListTargetSize
r.ISMPool.ComponentFreeListTargetSize
#Overview
name: r.ISMPool.ComponentFreeListTargetSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Target size for number of ISM components in the recycling free list.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ISMPool.ComponentFreeListTargetSize is to control the target size for the number of Instanced Static Mesh (ISM) components in the recycling free list within the Geometry Collection ISM Pool system.
This setting variable is primarily used by the Geometry Collection Engine module, which is part of Unreal Engine’s experimental features for handling large numbers of instanced geometry.
The value of this variable is set through the Unreal Engine console system, using the FAutoConsoleVariableRef mechanism. It’s initialized with a default value of 50.
The associated variable GComponentFreeListTargetSize directly interacts with r.ISMPool.ComponentFreeListTargetSize. They share the same value, with GComponentFreeListTargetSize being the actual variable used in the C++ code.
Developers must be aware that this variable affects the performance and memory usage of the Geometry Collection ISM Pool system. A larger value will keep more ISM components in memory for quick reuse, potentially improving performance at the cost of increased memory usage. A smaller value will reduce memory usage but might lead to more frequent allocations and deallocations of ISM components.
Best practices when using this variable include:
- Adjusting the value based on the specific needs of the project, considering the trade-off between performance and memory usage.
- Monitoring the performance impact when changing this value, especially in scenes with many Geometry Collection instances.
- Considering the target platforms and their memory constraints when setting this value.
Regarding the associated variable GComponentFreeListTargetSize:
- It’s a static integer variable used internally in the GeometryCollectionISMPoolComponent.cpp file.
- It’s used in the FGeometryCollectionISMPool::Tick function to determine how many ISM components should be kept in the free list.
- The actual logic uses this variable to calculate the target size of the free list, potentially reducing it to zero if recycling is disabled.
- Developers should be aware that changing r.ISMPool.ComponentFreeListTargetSize will directly affect the behavior of this internal variable and the ISM pool management logic.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionISMPoolComponent.cpp:33
Scope: file
Source code excerpt:
static int32 GComponentFreeListTargetSize = 50;
FAutoConsoleVariableRef CVarISMPoolComponentFreeListTargetSize(
TEXT("r.ISMPool.ComponentFreeListTargetSize"),
GComponentFreeListTargetSize,
TEXT("Target size for number of ISM components in the recycling free list."));
static bool GShadowCopyCustomData = false;
FAutoConsoleVariableRef CVarShadowCopyCustomData(
TEXT("r.ISMPool.ShadowCopyCustomData"),
#Associated Variable and Callsites
This variable is associated with another variable named GComponentFreeListTargetSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionISMPoolComponent.cpp:31
Scope: file
Source code excerpt:
// Target free list size when recycling ISM components.
// We try to maintain a pool of free components for fast allocation, but want to clean up when numbers get too high.
static int32 GComponentFreeListTargetSize = 50;
FAutoConsoleVariableRef CVarISMPoolComponentFreeListTargetSize(
TEXT("r.ISMPool.ComponentFreeListTargetSize"),
GComponentFreeListTargetSize,
TEXT("Target size for number of ISM components in the recycling free list."));
static bool GShadowCopyCustomData = false;
FAutoConsoleVariableRef CVarShadowCopyCustomData(
TEXT("r.ISMPool.ShadowCopyCustomData"),
GShadowCopyCustomData,
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionISMPoolComponent.cpp:593
Scope (from outer to inner):
file
function void FGeometryCollectionISMPool::Tick
Source code excerpt:
// Release components per tick until we reach minimum pool size.
const int32 RemoveCountPerTick = 1;
const int32 FreeListTargetSize = bRemovedReycle ? 0 : FMath::Max(FMath::Max(FreeListISM.Num() - RemoveCountPerTick, GComponentFreeListTargetSize), 0);
while (FreeListISM.Num() > FreeListTargetSize)
{
const int32 ISMIndex = FreeListISM.Pop(EAllowShrinking::No);
RemoveISM(ISMIndex, false, false);
}
}