UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MallocDoubleFreeFinder.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Map.h"
7#include "HAL/Platform.h"
8
9class FMalloc;
10class FOutputDevice;
11class UWorld;
12
14{
15public:
17
18#if UE_ALLOW_EXEC_COMMANDS
22 CORE_API virtual bool Exec(UWorld* InWorld, const TCHAR* Cmd, FOutputDevice& Ar) override;
23#endif
24
30 CORE_API void TrackSpecial(void* Ptr);
31
32 CORE_API virtual void Init();
33
35
36protected:
37 CORE_API virtual void TrackMalloc(void* Ptr, uint32 Size, int32 CallStackIndex);
38 CORE_API virtual void TrackFree(void* Ptr, uint32 OldSize, int32 CallStackIndex);
39
60 TMap<const void* const, TrackedAllocationData> TrackedCurrentAllocations; // Pointer as a key to a call stack for all the current allocations we known about
61 TMap<const void* const, TrackedAllocationData> TrackedFreeAllocations; // Pointer as a key to a call stack for all allocations that have been freed
62};
63
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
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
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
CORE_API bool GMallocDoubleFreeFinderEnabled
Definition MallocDoubleFreeFinder.cpp:17
CORE_API FMallocDoubleFreeFinder * GMallocDoubleFreeFinder
Definition MallocDoubleFreeFinder.cpp:16
uint32 Size
Definition VulkanMemory.cpp:4034
uint32_t uint32
Definition binka_ue_file_header.h:6
virtual CORE_API bool Exec(UWorld *InWorld, const TCHAR *Cmd, FOutputDevice &Ar)
Definition Exec.cpp:30
Definition MallocCallstackHandler.h:16
Definition MallocDoubleFreeFinder.h:14
virtual CORE_API void TrackMalloc(void *Ptr, uint32 Size, int32 CallStackIndex)
Definition MallocDoubleFreeFinder.cpp:37
TMap< const void *const, TrackedAllocationData > TrackedCurrentAllocations
Definition MallocDoubleFreeFinder.h:60
CORE_API void TrackSpecial(void *Ptr)
Definition MallocDoubleFreeFinder.cpp:78
TMap< const void *const, TrackedAllocationData > TrackedFreeAllocations
Definition MallocDoubleFreeFinder.h:61
static CORE_API FMalloc * OverrideIfEnabled(FMalloc *InUsedAlloc)
Definition MallocDoubleFreeFinder.cpp:153
virtual CORE_API void Init()
Definition MallocDoubleFreeFinder.cpp:24
virtual CORE_API void TrackFree(void *Ptr, uint32 OldSize, int32 CallStackIndex)
Definition MallocDoubleFreeFinder.cpp:52
Definition MemoryBase.h:99
Definition OutputDevice.h:133
Definition UnrealString.h.inl:34
Definition World.h:918
Definition MallocDoubleFreeFinder.h:41
TrackedAllocationData()
Definition MallocDoubleFreeFinder.h:44
int32 CallStackIndex
Definition MallocDoubleFreeFinder.h:43
TrackedAllocationData(SIZE_T InRequestedSize, int32 InCallStackIndex)
Definition MallocDoubleFreeFinder.h:49
SIZE_T Size
Definition MallocDoubleFreeFinder.h:42
~TrackedAllocationData()
Definition MallocDoubleFreeFinder.h:54