UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TagTrace.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "CoreTypes.h"
6#include "Trace/Config.h"
8
9class FName;
10
12// Fwd declare ELLMTag
13enum class ELLMTag : uint8;
14// Fwd declare LLM private tag data
15namespace UE {
16 namespace LLMPrivate {
17 class FTagData;
18 }
19}
20
25
26inline constexpr int32 TRACE_TAG = 257;
27
29#if !defined(UE_MEMORY_TAGS_TRACE_ENABLED)
30 #define UE_MEMORY_TAGS_TRACE_ENABLED 0
31#endif
32
33#if UE_MEMORY_TAGS_TRACE_ENABLED && UE_TRACE_ENABLED
34
36
47class FMemScope
48{
49public:
50 CORE_API FMemScope(); // Used with SetTagAndActivate
53 CORE_API FMemScope(const class FName& InName, bool bShouldActivate = true);
54 CORE_API FMemScope(const UE::LLMPrivate::FTagData* TagData, bool bShouldActivate = true);
56
57 CORE_API void SetTagAndActivate(const class FName& InName, bool bShouldActivate = true);
58
59private:
61 UE::Trace::Private::FScopedLogScope Inner;
63};
64
65
69template<typename TagType>
70class FDefaultMemScope : public FMemScope
71{
72public:
75 {
76 }
77};
78
82class FMemScopePtr
83{
84public:
87private:
88 UE::Trace::Private::FScopedLogScope Inner;
89};
90
92#define UE_MEMSCOPE(InTag) FMemScope PREPROCESSOR_JOIN(MemScope,__LINE__)(InTag);
93// UE_MEMSCOPE_PTR(InPtr) or UE_MEMSCOPE_PTR(InPtr, InRootHeap)
94#define UE_MEMSCOPE_PTR(InPtr, ...) FMemScopePtr PREPROCESSOR_JOIN(MemPtrScope,__LINE__)((uint64)InPtr, ##__VA_ARGS__);
95#define UE_MEMSCOPE_DEFAULT(InTag) FDefaultMemScope PREPROCESSOR_JOIN(MemScope,__LINE__)(InTag);
96#define UE_MEMSCOPE_UNINITIALIZED(Line) FMemScope PREPROCESSOR_JOIN(MemScope,Line);
97#define UE_MEMSCOPE_ACTIVATE(Line, InTag) PREPROCESSOR_JOIN(MemScope,Line).SetTagAndActivate(InTag);
98
99#else // UE_MEMORY_TAGS_TRACE_ENABLED
100
102#define UE_MEMSCOPE(...)
103#define UE_MEMSCOPE_PTR(...)
104#define UE_MEMSCOPE_DEFAULT(...)
105#define UE_MEMSCOPE_UNINITIALIZED(...)
106#define UE_MEMSCOPE_ACTIVATE(...)
107
108#endif // UE_MEMORY_TAGS_TRACE_ENABLED
109
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
DIRECTLINK_API Display
Definition DirectLinkLog.h:8
uint32 HeapId
Definition MemoryTrace.h:30
@ SystemMemory
Definition MemoryTrace.h:35
int32 MemoryTrace_GetActiveTag()
Definition TagTrace.cpp:436
CORE_API int32 MemoryTrace_AnnounceFNameTag(const class FName &TagName)
CORE_API int32 MemoryTrace_GetActiveTag()
Definition TagTrace.cpp:436
constexpr int32 TRACE_TAG
Definition TagTrace.h:26
CORE_API int32 MemoryTrace_AnnounceCustomTag(int32 Tag, int32 ParentTag, const TCHAR *Display)
Definition TagTrace.cpp:411
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition NameTypes.h:617
Definition AdvancedWidgetsModule.cpp:13