r.FBlueprintContext.VirtualStackAllocatorStackSize
r.FBlueprintContext.VirtualStackAllocatorStackSize
#Overview
name: r.FBlueprintContext.VirtualStackAllocatorStackSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Default size for FBlueprintContext\'s FVirtualStackAllocator
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FBlueprintContext.VirtualStackAllocatorStackSize is to set the default size for FBlueprintContext’s FVirtualStackAllocator. This setting variable is primarily used in the Blueprint scripting system of Unreal Engine.
This setting variable is relied upon by the CoreUObject module of Unreal Engine, specifically within the scripting and Blueprint execution subsystem. It’s used to configure the memory allocation for Blueprint contexts.
The value of this variable is set through the FAutoConsoleVariableRef mechanism, which allows it to be configured via console commands or configuration files. It’s initialized with a default value of 8 * 1024 * 1024 (8 MB).
The associated variable BlueprintContextVirtualStackAllocatorSize directly interacts with this setting. They share the same value, with BlueprintContextVirtualStackAllocatorSize being the actual variable used in the code to determine the allocator size.
Developers must be aware that this variable is marked as ECVF_ReadOnly, meaning it cannot be changed at runtime. It should be set before the engine initialization or through configuration files.
Best practices when using this variable include:
- Carefully consider the memory requirements of your Blueprint scripts before adjusting this value.
- Monitor memory usage in complex Blueprint scenarios to ensure this allocation is sufficient.
- If adjusting, do so in configuration files or very early in the engine initialization process.
Regarding the associated variable BlueprintContextVirtualStackAllocatorSize:
- It’s the actual integer variable that holds the stack allocator size.
- It’s used directly in the construction of FBlueprintContext when UE_USE_VIRTUAL_STACK_ALLOCATOR_FOR_SCRIPT_VM is defined.
- Developers should not modify this variable directly in code, but rather use the console variable r.FBlueprintContext.VirtualStackAllocatorStackSize to configure it.
- Its value is critical for the performance and memory usage of Blueprint execution, so any changes should be thoroughly tested.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp:151
Scope: file
Source code excerpt:
static int32 BlueprintContextVirtualStackAllocatorSize = 8 * 1024 * 1024;
FAutoConsoleVariableRef CVarBlueprintContextVirtualStackAllocatorStackSize(
TEXT("r.FBlueprintContext.VirtualStackAllocatorStackSize"),
BlueprintContextVirtualStackAllocatorSize,
TEXT("Default size for FBlueprintContext's FVirtualStackAllocator"),
ECVF_ReadOnly
);
static int BlueprintContextVirtualStackAllocatorDecommitMode = (int)EVirtualStackAllocatorDecommitMode::AllOnDestruction;
#Associated Variable and Callsites
This variable is associated with another variable named BlueprintContextVirtualStackAllocatorSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp:149
Scope: file
Source code excerpt:
PRAGMA_ENABLE_DEPRECATION_WARNINGS
static int32 BlueprintContextVirtualStackAllocatorSize = 8 * 1024 * 1024;
FAutoConsoleVariableRef CVarBlueprintContextVirtualStackAllocatorStackSize(
TEXT("r.FBlueprintContext.VirtualStackAllocatorStackSize"),
BlueprintContextVirtualStackAllocatorSize,
TEXT("Default size for FBlueprintContext's FVirtualStackAllocator"),
ECVF_ReadOnly
);
static int BlueprintContextVirtualStackAllocatorDecommitMode = (int)EVirtualStackAllocatorDecommitMode::AllOnDestruction;
FAutoConsoleVariableRef CVarBlueprintContextVirtualStackAllocatorDecommitMode(
#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp:168
Scope: file
Source code excerpt:
#if UE_USE_VIRTUAL_STACK_ALLOCATOR_FOR_SCRIPT_VM
: VirtualStackAllocator(
BlueprintContextVirtualStackAllocatorSize,
static_cast<EVirtualStackAllocatorDecommitMode>(BlueprintContextVirtualStackAllocatorDecommitMode))
#else
: VirtualStackAllocator(0, EVirtualStackAllocatorDecommitMode::AllOnDestruction)
#endif
{
ensure(BlueprintContextVirtualStackAllocatorDecommitMode >= 0 && BlueprintContextVirtualStackAllocatorDecommitMode < (int)EVirtualStackAllocatorDecommitMode::NumModes);