RigVM.NameCacheMaxSize
RigVM.NameCacheMaxSize
#Overview
name: RigVM.NameCacheMaxSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Change to control how many names are cached per VM instance.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of RigVM.NameCacheMaxSize is to control the maximum number of names that can be cached per RigVM instance in the RigVM system, which is part of Unreal Engine’s animation and rigging framework.
This setting variable is primarily used within the RigVM plugin, specifically in the RigVM module. Based on the callsites, it’s evident that this variable is crucial for managing the name cache size in the RigVM system.
The value of this variable is set using a console variable (CVar) named CVarRigVMNameCacheMaxSize. It’s initialized with a default value of 4096, but can be changed at runtime through the console or configuration files.
The associated variable CVarRigVMNameCacheMaxSize directly interacts with RigVM.NameCacheMaxSize. They essentially represent the same setting, with CVarRigVMNameCacheMaxSize being the actual console variable implementation.
Developers must be aware that this variable is only active when the engine is running with editor support (#if WITH_EDITOR). It’s used to limit the size of the name cache, which can impact memory usage and potentially performance of the RigVM system.
Best practices when using this variable include:
- Monitor the log for warnings about exceeding the maximum cache size.
- Adjust the value based on the specific needs of your project, balancing between performance and memory usage.
- Be cautious when increasing this value, as it could lead to increased memory consumption.
Regarding the associated variable CVarRigVMNameCacheMaxSize:
- It’s the actual implementation of the console variable for RigVM.NameCacheMaxSize.
- It’s used to get the current value of the setting in the code, particularly in the CheckCacheSize function of FRigVMNameCache.
- Developers can modify this value at runtime using console commands, which provides flexibility in tuning the RigVM system’s behavior without recompiling the code.
- When the cache size reaches this limit, a warning is logged, indicating that the maximum size has been reached.
In summary, both RigVM.NameCacheMaxSize and CVarRigVMNameCacheMaxSize are crucial for managing the name cache in the RigVM system, allowing developers to fine-tune memory usage and potentially impact performance in the animation and rigging pipeline of Unreal Engine.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVM/Private/RigVMCore/RigVMNameCache.cpp:5
Scope: file
Source code excerpt:
#if WITH_EDITOR
#include "RigVMCore/RigVM.h"
TAutoConsoleVariable<int32> CVarRigVMNameCacheMaxSize(TEXT("RigVM.NameCacheMaxSize"), 4096, TEXT("Change to control how many names are cached per VM instance."));
#endif
////////////////////////////////////////////////////////////////////////////////
// FRigVMNameOp
////////////////////////////////////////////////////////////////////////////////
#Associated Variable and Callsites
This variable is associated with another variable named CVarRigVMNameCacheMaxSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVM/Private/RigVMCore/RigVMNameCache.cpp:5
Scope: file
Source code excerpt:
#if WITH_EDITOR
#include "RigVMCore/RigVM.h"
TAutoConsoleVariable<int32> CVarRigVMNameCacheMaxSize(TEXT("RigVM.NameCacheMaxSize"), 4096, TEXT("Change to control how many names are cached per VM instance."));
#endif
////////////////////////////////////////////////////////////////////////////////
// FRigVMNameOp
////////////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Plugins/Runtime/RigVM/Source/RigVM/Private/RigVMCore/RigVMNameCache.cpp:347
Scope (from outer to inner):
file
function bool FRigVMNameCache::CheckCacheSize
Source code excerpt:
bool FRigVMNameCache::CheckCacheSize() const
{
if(CVarRigVMNameCacheMaxSize.GetValueOnAnyThread() == NameCache.Num() || CVarRigVMNameCacheMaxSize.GetValueOnAnyThread() == BoolCache.Num())
{
UE_LOG(LogRigVM, Warning, TEXT("FRigVMNameCache exceeded maximum size of %d. You can change it using the 'RigVM.NameCacheMaxSize' console variable."), CVarRigVMNameCacheMaxSize.GetValueOnAnyThread());
return false;
}
return true;
}
#endif