Editor.AsyncAssetCompilationMaxMemoryUsage
Editor.AsyncAssetCompilationMaxMemoryUsage
#Overview
name: Editor.AsyncAssetCompilationMaxMemoryUsage
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 - No hard memory limit, will be tuned against system available memory (recommended default).\nN - Try to limit total memory usage for asset compilation to this amount (in GB).\nTry to stay under specified memory limit for asset compilation by reducing concurrency when under memory pressure.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Editor.AsyncAssetCompilationMaxMemoryUsage is to control the maximum memory usage for asynchronous asset compilation in the Unreal Engine editor. This setting is part of the asset compilation system, which is responsible for processing and preparing assets for use in the engine.
This setting variable is primarily used in the Engine module, specifically within the asset compiling manager. It’s referenced in the AssetCompilingManager.cpp file, which suggests that it’s an integral part of the asset compilation process.
The value of this variable is set through a console variable (CVarAsyncAssetCompilationMaxMemoryUsage) using the TAutoConsoleVariable template. It’s initialized with a default value of 0, which means there’s no hard memory limit by default.
The associated variable CVarAsyncAssetCompilationMaxMemoryUsage directly interacts with Editor.AsyncAssetCompilationMaxMemoryUsage. They share the same value and are used interchangeably in the code.
Developers must be aware that:
- Setting this variable to 0 (default) means no hard memory limit will be applied, and the system will automatically tune the limit based on available memory.
- Setting a non-zero value (N) will try to limit the total memory usage for asset compilation to N gigabytes.
- The system will attempt to stay under the specified memory limit by reducing concurrency when under memory pressure.
Best practices when using this variable include:
- Leave it at the default value (0) unless you have specific memory constraints or issues.
- If setting a custom value, carefully consider your system’s capabilities and the complexity of your project’s assets.
- Monitor asset compilation performance and adjust the value if necessary, balancing between compilation speed and memory usage.
Regarding the associated variable CVarAsyncAssetCompilationMaxMemoryUsage:
- It’s a console variable that directly controls the Editor.AsyncAssetCompilationMaxMemoryUsage setting.
- It’s used in the FMemoryBoundQueuedThreadPoolWrapper class to determine the hard memory limit for asset compilation.
- The GetHardMemoryLimit() function converts the value from gigabytes to bytes for internal use.
- Developers can modify this variable at runtime through console commands, allowing for dynamic adjustments to the memory limit.
When working with CVarAsyncAssetCompilationMaxMemoryUsage, developers should be aware that changes to this variable will immediately affect the memory limit for asset compilation. It’s important to use this variable responsibly and in conjunction with monitoring tools to ensure optimal performance and stability of the asset compilation process.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:60
Scope: file
Source code excerpt:
// AsyncAssetCompilationMaxMemoryUsage clamps system available memory
static TAutoConsoleVariable<int32> CVarAsyncAssetCompilationMaxMemoryUsage(
TEXT("Editor.AsyncAssetCompilationMaxMemoryUsage"),
0,
TEXT("0 - No hard memory limit, will be tuned against system available memory (recommended default).\n")
TEXT("N - Try to limit total memory usage for asset compilation to this amount (in GB).\n")
TEXT("Try to stay under specified memory limit for asset compilation by reducing concurrency when under memory pressure.\n"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarAsyncAssetCompilationMaxMemoryUsage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:59
Scope: file
Source code excerpt:
// AsyncAssetCompilationMaxMemoryUsage clamps system available memory
static TAutoConsoleVariable<int32> CVarAsyncAssetCompilationMaxMemoryUsage(
TEXT("Editor.AsyncAssetCompilationMaxMemoryUsage"),
0,
TEXT("0 - No hard memory limit, will be tuned against system available memory (recommended default).\n")
TEXT("N - Try to limit total memory usage for asset compilation to this amount (in GB).\n")
TEXT("Try to stay under specified memory limit for asset compilation by reducing concurrency when under memory pressure.\n"),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:128
Scope (from outer to inner):
file
class class FMemoryBoundQueuedThreadPoolWrapper : public FQueuedThreadPoolWrapper
function int64 GetHardMemoryLimit
Source code excerpt:
int64 GetHardMemoryLimit() const
{
return (int64)CVarAsyncAssetCompilationMaxMemoryUsage.GetValueOnAnyThread() * 1024 * 1024 * 1024;
}
int64 GetDefaultMemoryPerAsset() const
{
return FMath::Max(0ll, (int64)CVarAsyncAssetCompilationMemoryPerCore.GetValueOnAnyThread(false) * 1024 * 1024 * 1024);
}