UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VirtualAllocPageStatus.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
#pragma once
3
4
#include "
HAL/LowLevelMemTracker.h
"
5
6
// FVirtualAllocPageTracker is only referenced by LLM-specific code
7
#define UE_VIRTUALALLOC_PAGE_STATUS_ENABLED ENABLE_LOW_LEVEL_MEM_TRACKER
8
9
#if UE_VIRTUALALLOC_PAGE_STATUS_ENABLED
10
11
#include "
HAL/Platform.h
"
12
#include "
HAL/PlatformMutex.h
"
13
#include "
Math/NumericLimits.h
"
14
25
struct
FHashMapLinearProbingVAlloc
26
{
27
public
:
28
void
Init
(
uint64
PageSize);
29
~FHashMapLinearProbingVAlloc
();
30
31
uint64
*
Find
(
uint64
Key);
32
uint64
& FindOrAdd(
uint64
Key,
uint64
ValueIfMissing
);
33
34
uint64
RemoveAndGetValue
(
uint64
Key,
uint64
ValueIfMissing
);
35
36
private
:
37
enum class
EValueType
38
{
39
Unallocated
,
40
Tombstone
,
41
Active
,
// Any Key value <= MaxKey is an Active address.
42
};
43
44
struct
FBucketEntry
45
{
46
uint64
Key;
47
uint64
Value
;
48
49
EValueType GetValueType();
50
void
SetAsActive
(
uint64
InKey
);
51
void
SetAsUnallocated
();
52
void
SetAsTombstone
();
53
};
54
55
private
:
56
void
* Malloc(
size_t
Size
);
57
void
Free
(
void
* Ptr,
size_t
Size
);
58
void
Realloc(
int64
InNum
);
59
FBucketEntry
* FindBucket(
uint64
Key);
60
61
private
:
62
FBucketEntry
* Buckets =
nullptr
;
63
int64
NumBuckets = 0;
64
int64
NumActive = 0;
65
static
constexpr
float
DesiredPopulation
= 0.3f;
66
static
constexpr
uint64
MaxKey
=
MAX_uint64
-
static_cast<
uint64
>
(EValueType::Active);
67
static
constexpr
uint64
CollisionResolutionDeltaFraction
= 32;
68
};
69
81
struct
FVirtualAllocPageStatus
82
{
83
FVirtualAllocPageStatus
();
84
89
int64
MarkChangedAndReturnDeltaSize
(
void
*
InStartAddress
,
SIZE_T
InSize
,
bool
bCommitted);
91
void
AddReservationSize
(
void
*
InReservationAddress
,
SIZE_T
InSize
,
SIZE_T
&
OutOldSize
);
93
SIZE_T
GetAndRemoveReservationSize
(
void
*
InReservationAddress
);
94
95
private
:
96
UE::FPlatformRecursiveMutex
Mutex
;
97
FHashMapLinearProbingVAlloc
GroupToPageBitsMap
;
98
FHashMapLinearProbingVAlloc
PageToReservationSizeMap
;
99
uint64
PageSize = 1;
100
uint64
ReservationAlignment
= 1;
101
uint64
AccumulatedSize
= 0;
102
103
static
constexpr
uint64
PagesPerGroup
=
sizeof
(
uint64
) * 8;
104
};
105
106
#endif
// UE_VIRTUALALLOC_PAGE_STATUS_ENABLED
AnimPhysLinearConstraintType::Free
@ Free
EAudioDeviceChangedState::Active
@ Active
Platform.h
SIZE_T
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition
Platform.h:1150
int64
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition
Platform.h:1127
uint64
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition
Platform.h:1117
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
Init
void Init()
Definition
LockFreeList.h:4
LowLevelMemTracker.h
NumericLimits.h
MAX_uint64
#define MAX_uint64
Definition
NumericLimits.h:22
PlatformMutex.h
EColorPickerChannels::Value
@ Value
EStringTableLoadingPolicy::Find
@ Find
Size
uint32 Size
Definition
VulkanMemory.cpp:4034
MeshPaintVirtualTexture::Mutex
UE::FRecursiveMutex Mutex
Definition
MeshPaintVirtualTexture.cpp:164
UE::FPlatformRecursiveMutex
FPThreadsRecursiveMutex FPlatformRecursiveMutex
Definition
AndroidPlatformMutex.h:12
Engine
Source
Runtime
Core
Private
Windows
VirtualAllocPageStatus.h
Generated by
1.9.8