CreateD3D12Texture causes two OnLowLevelAllocs in LLM to be called with the same pointer and the same channel, leading to a warning.
LLM WARNING: Replacing allocation in tracking map. Alloc/Free Mismatch.
The pointer is to an FD3D12Resource allocated by the function CreatePlacedResource. During CreatePlacedResource, the resource is allocated with the new keyword. That keyword leads to FMemory::Malloc tracking the allocation with LLM.
Later on, the UpdateD3D12TextureStats function calls LLM tracking functions again on the FD3D12Resource. The second call uses the same channel as the FMemory::Malloc call, leading to LLM warning about a mismatched allocation/free.
Set a breakpoint at the start of the CreateD3D12Texture function in any project in 5.4.4EGL.
After this breakpoint is hit, add breakpoints to, at a minimum, the call sites indicted at the top of both call stacks and LowLevelMemoryUtils.h:265. CreatePlacedResource and UpdateD3D12TextureStats are useful places to break to reduce the number of times the LLM breakpoint is hit as the pool allocator will cause a fair number of allocations.
Continuing execution should eventually lead to 1. CreatePlacedResource from a pool allocator tracking via FMemory::Malloc with a size of 240 and an alignment of 16. Note the pointer and tag used here (value1 and value2).
Continuing further, the UpdateTextureStats function will cause two more LLM OnLevelLevelAlloc's. The first is a platform channel of the texture size, which will succeed. The second is an allocation on the default channel of the texture size. The pointer used here is the FD3D12Resource used in the malloc from the first call and already exists in the map. This leads to a warning and the original memory allocation being lost.
Initially LLM Track:
EngineTest.exe!FD3D12Adapter::CreatePlacedResource(const FD3D12ResourceDesc & InDesc, FD3D12Heap * BackingHeap, unsigned __int64 HeapOffset, D3D12_RESOURCE_STATES InInitialState, ED3D12ResourceStateMode InResourceStateMode, D3D12_RESOURCE_STATES InDefaultState, const D3D12_CLEAR_VALUE * ClearValue, FD3D12Resource * * ppOutResource, const wchar_t * Name, bool bVerifyHResult) Line 945 C++ EngineTest.exe!FD3D12PoolAllocator::CreatePlacedResource(const FRHIPoolAllocationData & InAllocationData, const FD3D12ResourceDesc & InDesc, D3D12_RESOURCE_STATES InCreateState, ED3D12ResourceStateMode InResourceStateMode, const D3D12_CLEAR_VALUE * InClearValue, const wchar_t * InName) Line 477 C++ EngineTest.exe!FD3D12PoolAllocator::AllocateResource(unsigned int GPUIndex, D3D12_HEAP_TYPE InHeapType, const FD3D12ResourceDesc & InDesc, unsigned __int64 InSize, unsigned int InAllocationAlignment, ED3D12ResourceStateMode InResourceStateMode, D3D12_RESOURCE_STATES InCreateState, const D3D12_CLEAR_VALUE * InClearValue, const wchar_t * InName, FD3D12ResourceLocation & ResourceLocation) Line 401 C++ EngineTest.exe!FD3D12TextureAllocatorPool::AllocateTexture(FD3D12ResourceDesc Desc, const D3D12_CLEAR_VALUE * ClearValue, EPixelFormat UEFormat, FD3D12ResourceLocation & TextureLocation, const D3D12_RESOURCE_STATES InitialState, const wchar_t * Name) Line 1813 C++ EngineTest.exe!SafeCreateTexture2D(FD3D12Device * pDevice, FD3D12Adapter * Adapter, const FD3D12ResourceDesc & TextureDesc, const D3D12_CLEAR_VALUE * ClearValue, FD3D12ResourceLocation * OutTexture2D, FD3D12BaseShaderResource * Owner, EPixelFormat Format, ETextureCreateFlags Flags, D3D12_RESOURCE_STATES InitialState, const wchar_t * Name) Line 783 C++ EngineTest.exe!FD3D12DynamicRHI::CreateD3D12Texture::__l2::<lambda>(FD3D12Device * Device) Line 937 C++ [Inline Frame] EngineTest.exe!FD3D12LinkedAdapterObject<FD3D12Texture>::CreateLinkedObjects(FRHIGPUMask GPUMask, const FD3D12Adapter::CreateLinkedObject::__l2::void <lambda>(void) &) Line 190 C++ [Inline Frame] EngineTest.exe!FD3D12Adapter::CreateLinkedObject(FRHIGPUMask) Line 389 C++ > EngineTest.exe!FD3D12DynamicRHI::CreateD3D12Texture(const FRHITextureCreateDesc & InCreateDesc, FRHICommandListBase * RHICmdList, ID3D12ResourceAllocator * ResourceAllocator) Line 861 C++ EngineTest.exe!FD3D12DynamicRHI::RHICreateTexture(FRHICommandListBase & RHICmdList, const FRHITextureCreateDesc & CreateDesc) Line 981 C++ EngineTest.exe!FColoredTexture<255,255,255,255>::InitRHI(FRHICommandListBase & RHICmdList) Line 62 C++ [Inline Frame] EngineTest.exe!FRenderResource::InitPreRHIResources::__l2::<lambda>(FRenderResource *) Line 131 C++ EngineTest.exe!FRenderResourceList::ForEach<`FRenderResource::InitPreRHIResources'::`2'::void <lambda>(void)>(const FRenderResource::InitPreRHIResources::__l2::void <lambda>(void) & Function) Line 81 C++ EngineTest.exe!FRenderResource::InitPreRHIResources() Line 133 C++ EngineTest.exe!FD3D12DynamicRHI::Init() Line 1811 C++ EngineTest.exe!RHIInit(bool bHasEditorToken) Line 317 C++ EngineTest.exe!FEngineLoop::PreInitPreStartupScreen(const wchar_t * CmdLine) Line 3247 C++ [Inline Frame] EngineTest.exe!FEngineLoop::PreInit(const wchar_t *) Line 4476 C++ [Inline Frame] EngineTest.exe!EnginePreInit(const wchar_t *) Line 41 C++ EngineTest.exe!GuardedMain(const wchar_t * CmdLine) Line 136 C++ EngineTest.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 247 C++ EngineTest.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 299 C++
Conflict:
EngineTest.exe!LLMMap<PointerKey,unsigned int,UE::LLMPrivate::FLLMTracker::FLowLevelAllocInfo,unsigned int>::Add(const PointerKey & Key, const unsigned int & Value1, const UE::LLMPrivate::FLLMTracker::FLowLevelAllocInfo & Value2) Line 270 C++ EngineTest.exe!UE::LLMPrivate::FLLMTracker::TrackAllocation(const void * Ptr, __int64 Size, const UE::LLMPrivate::FTagData * ActiveTagData, ELLMAllocType AllocType, UE::LLMPrivate::FLLMThreadState * State, bool bTrackInMemPro) Line 4863 C++ [Inline Frame] EngineTest.exe!UE::LLMPrivate::FLLMTracker::TrackAllocation(const void *) Line 4798 C++ EngineTest.exe!FLowLevelMemTracker::OnLowLevelAlloc(ELLMTracker Tracker, const void * Ptr, unsigned __int64 Size, ELLMTag DefaultTag, ELLMAllocType AllocType, bool bTrackInMemPro) Line 2373 C++ EngineTest.exe!FD3D12TextureStats::UpdateD3D12TextureStats(FD3D12Texture & Texture, const FD3D12ResourceDesc & ResourceDesc, const FRHITextureDesc & TextureDesc, unsigned __int64 TextureSize, bool bNewTexture, bool bAllocating) Line 338 C++ EngineTest.exe!FD3D12TextureStats::D3D12TextureAllocated(FD3D12Texture & Texture) Line 391 C++ EngineTest.exe!FD3D12DynamicRHI::CreateD3D12Texture(const FRHITextureCreateDesc & InCreateDesc, FRHICommandListBase * RHICmdList, ID3D12ResourceAllocator * ResourceAllocator) Line 964 C++ EngineTest.exe!FD3D12DynamicRHI::RHICreateTexture(FRHICommandListBase & RHICmdList, const FRHITextureCreateDesc & CreateDesc) Line 981 C++ EngineTest.exe!FColoredTexture<255,255,255,255>::InitRHI(FRHICommandListBase & RHICmdList) Line 62 C++ [Inline Frame] EngineTest.exe!FRenderResource::InitPreRHIResources::__l2::<lambda>(FRenderResource *) Line 131 C++ EngineTest.exe!FRenderResourceList::ForEach<`FRenderResource::InitPreRHIResources'::`2'::void <lambda>(void)>(const FRenderResource::InitPreRHIResources::__l2::void <lambda>(void) & Function) Line 81 C++ EngineTest.exe!FRenderResource::InitPreRHIResources() Line 133 C++ EngineTest.exe!FD3D12DynamicRHI::Init() Line 1811 C++ EngineTest.exe!RHIInit(bool bHasEditorToken) Line 317 C++ EngineTest.exe!FEngineLoop::PreInitPreStartupScreen(const wchar_t * CmdLine) Line 3247 C++ [Inline Frame] EngineTest.exe!FEngineLoop::PreInit(const wchar_t *) Line 4476 C++ [Inline Frame] EngineTest.exe!EnginePreInit(const wchar_t *) Line 41 C++ EngineTest.exe!GuardedMain(const wchar_t * CmdLine) Line 136 C++ EngineTest.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 247 C++ EngineTest.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 299 C++
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-229245 in the post.
0 |
Component | UE - Rendering Architecture - RHI |
---|---|
Affects Versions | 5.6, 5.4.4 |
Target Fix | 5.6 |
Created | Oct 31, 2024 |
---|---|
Updated | Dec 3, 2024 |