Editor.AsyncAssetCompilationMemoryPerCore
Editor.AsyncAssetCompilationMemoryPerCore
#Overview
name: Editor.AsyncAssetCompilationMemoryPerCore
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
How much memory (in GB) should tasks reserve that report a required memory amount Unknown (-1).\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Editor.AsyncAssetCompilationMemoryPerCore is to specify the amount of memory (in GB) that should be reserved for tasks that report an unknown (-1) required memory amount during asynchronous asset compilation. This setting is crucial for managing memory allocation in the Unreal Engine’s asset compilation system.
This setting variable is primarily used by the Unreal Engine’s asset compilation subsystem, specifically within the Engine module. It’s utilized in the AssetCompilingManager, which is responsible for managing the compilation of assets asynchronously.
The value of this variable is set using a TAutoConsoleVariable, which means it can be modified at runtime through console commands. By default, it’s set to 4 GB.
The associated variable CVarAsyncAssetCompilationMemoryPerCore directly interacts with Editor.AsyncAssetCompilationMemoryPerCore. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects memory allocation for asset compilation tasks. Setting it too low might cause memory-related issues during compilation, while setting it too high could potentially waste system resources.
Best practices when using this variable include:
- Adjusting it based on the complexity of your project’s assets and the available system memory.
- Monitoring asset compilation performance and memory usage to fine-tune this value.
- Considering the impact on other system processes when increasing this value.
Regarding the associated variable CVarAsyncAssetCompilationMemoryPerCore:
The purpose of CVarAsyncAssetCompilationMemoryPerCore is to provide programmatic access to the Editor.AsyncAssetCompilationMemoryPerCore setting within the C++ code.
This variable is used within the Engine module, specifically in the AssetCompilingManager and related classes.
Its value is set automatically based on the Editor.AsyncAssetCompilationMemoryPerCore console variable.
It interacts directly with Editor.AsyncAssetCompilationMemoryPerCore and is used to retrieve the setting’s value in the code.
Developers should be aware that this variable is used to calculate the default memory per asset in the GetDefaultMemoryPerAsset() function of the FMemoryBoundQueuedThreadPoolWrapper class.
Best practices for using this variable include:
- Using it to read the current setting value rather than hardcoding memory values.
- Considering thread safety when accessing its value, as demonstrated by the use of GetValueOnAnyThread() in the code.
- Being cautious when modifying its value, as it directly impacts asset compilation memory allocation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:53
Scope: file
Source code excerpt:
// default is 4 GB
static TAutoConsoleVariable<int32> CVarAsyncAssetCompilationMemoryPerCore(
TEXT("Editor.AsyncAssetCompilationMemoryPerCore"),
4,
TEXT("How much memory (in GB) should tasks reserve that report a required memory amount Unknown (-1).\n"),
ECVF_Default);
// AsyncAssetCompilationMaxMemoryUsage clamps system available memory
static TAutoConsoleVariable<int32> CVarAsyncAssetCompilationMaxMemoryUsage(
#Associated Variable and Callsites
This variable is associated with another variable named CVarAsyncAssetCompilationMemoryPerCore
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:52
Scope: file
Source code excerpt:
// for Required Memory when the Task reports -1 (Unknown)
// default is 4 GB
static TAutoConsoleVariable<int32> CVarAsyncAssetCompilationMemoryPerCore(
TEXT("Editor.AsyncAssetCompilationMemoryPerCore"),
4,
TEXT("How much memory (in GB) should tasks reserve that report a required memory amount Unknown (-1).\n"),
ECVF_Default);
// AsyncAssetCompilationMaxMemoryUsage clamps system available memory
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AssetCompilingManager.cpp:133
Scope (from outer to inner):
file
class class FMemoryBoundQueuedThreadPoolWrapper : public FQueuedThreadPoolWrapper
function int64 GetDefaultMemoryPerAsset
Source code excerpt:
int64 GetDefaultMemoryPerAsset() const
{
return FMath::Max(0ll, (int64)CVarAsyncAssetCompilationMemoryPerCore.GetValueOnAnyThread(false) * 1024 * 1024 * 1024);
}
int64 GetMemoryLimit() const
{
const FPlatformMemoryStats MemoryStats = FPlatformMemory::GetStats();