VA.LazyInitSystem
VA.LazyInitSystem
#Overview
name: VA.LazyInitSystem
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When true the VA system will be lazy initialized on first use
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of VA.LazyInitSystem is to control the initialization behavior of the Unreal Engine’s virtualization system. It determines whether the virtualization system should be lazily initialized on first use or initialized immediately.
This setting variable is primarily used by the Unreal Engine’s virtualization system, which is part of the Core module. The virtualization system is responsible for managing virtual assets and optimizing memory usage in the engine.
The value of this variable is set through a console variable (CVar) named CVarLazyInitSystem. It is defined as a static TAutoConsoleVariable
The associated variable CVarLazyInitSystem interacts directly with VA.LazyInitSystem. They share the same value and purpose. CVarLazyInitSystem is used in the C++ code to check the current setting and determine the initialization behavior of the virtualization system.
Developers must be aware that changing this variable will affect the initialization timing of the virtualization system. When set to true, the system will only initialize when it’s first used, which can potentially improve startup times but may introduce a slight delay when the system is first accessed.
Best practices when using this variable include:
- Leave it at its default value (false) unless there’s a specific need for lazy initialization.
- If enabling lazy initialization, ensure that all systems dependent on virtualization can handle a potential delay in its availability.
- Use this setting in conjunction with other virtualization system settings for optimal performance.
- Monitor performance impacts when changing this setting, especially in large projects.
Regarding the associated variable CVarLazyInitSystem:
- It is the C++ representation of the VA.LazyInitSystem console variable.
- It is used directly in the code to check the current setting, as seen in the ShouldLazyInitializeSystem function.
- Developers should use this variable when they need to programmatically check or modify the lazy initialization setting within C++ code.
- Best practices include using GetValueOnAnyThread() for thread-safe access to the variable’s value, as demonstrated in the provided code snippet.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Virtualization/VirtualizationSystem.cpp:43
Scope (from outer to inner):
file
namespace UE::Virtualization
Source code excerpt:
static TAutoConsoleVariable<bool> CVarLazyInitSystem(
TEXT("VA.LazyInitSystem"),
false,
TEXT("When true the VA system will be lazy initialized on first use"));
/** Default implementation to be used when the system is disabled */
class FNullVirtualizationSystem : public IVirtualizationSystem
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarLazyInitSystem
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Virtualization/VirtualizationSystem.cpp:42
Scope (from outer to inner):
file
namespace UE::Virtualization
Source code excerpt:
TEXT("When true the VA system will be disabled as though 'SystemName' was 'None'"));
static TAutoConsoleVariable<bool> CVarLazyInitSystem(
TEXT("VA.LazyInitSystem"),
false,
TEXT("When true the VA system will be lazy initialized on first use"));
/** Default implementation to be used when the system is disabled */
class FNullVirtualizationSystem : public IVirtualizationSystem
#Loc: <Workspace>/Engine/Source/Runtime/Core/Private/Virtualization/VirtualizationSystem.cpp:213
Scope (from outer to inner):
file
namespace UE::Virtualization
function bool ShouldLazyInitializeSystem
Source code excerpt:
return true;
}
else if (CVarLazyInitSystem.GetValueOnAnyThread())
{
UE_LOG(LogVirtualization, Display, TEXT("The virtualization system will lazy initialize due to a cvar"));
return true;
}
else
{