r.ISMPool.ComponentFreeListTargetSize

r.ISMPool.ComponentFreeListTargetSize

#Overview

name: r.ISMPool.ComponentFreeListTargetSize

This variable is created as a Console Variable (cvar).

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:

  1. Adjusting the value based on the specific needs of the project, considering the trade-off between performance and memory usage.
  2. Monitoring the performance impact when changing this value, especially in scenes with many Geometry Collection instances.
  3. Considering the target platforms and their memory constraints when setting this value.

Regarding the associated variable GComponentFreeListTargetSize:

#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);
		}
	}