Search Issue Tracker
Fixed in 2018.2
Fixed in 2018.1
[Enlighten] Memory leak. UnityGPUTexture and UnityGPUTextureUpdater objects are being leaked
[Enlighten] Memory leak. UnityGPUTexture and UnityGPUTextureUpdater objects are being leaked.
1. What happened
When running the attached project originally from https://fogbugz.unity3d.com/f/cases/991939/ with a small modification to make it automatically change between the two test scenes it appears that we are creating UnityGPUTexture and UnityGPUTextureUpdater objects but never releasing them.
This appears to have been one of the original issues in https://fogbugz.unity3d.com/f/cases/991939/
Tested against db66e9789be1
Currently tested by
1) Building and running the project under the Memory Analyser for PS4 in a development builds. After leavign the build running for 10 mins you can see that there is an increasing number of unfreed UnityGPUTexture and UnityGPUTextureUpdater allocations.
2) Running a debugable PS4 player or debugable Windows Standalone player you can set a breakpoint in the UnityGPUTextureUpdater::Create() function and the UnityGPUTexture::Create() function and see that when realtimeGI.unity is loaded these methods allocate new objects. Setting a breakpoint in UnityGPUTextureUpdater::Release() and UnityGPUTexture::Release() will never have these methods being called. It appears like solving the UnityGPUTexture::Release() will probably take care of calling UnityGPUTextureUpdater::Release().
3) Changing the allocator used for Enlighten in EnlightenRuntimeManager::InitializeClass() from Geo::AnsiAllocator to Geo::GeoMemoryDefault and in UpdateEnlightenRuntimeManager() printing out the total memory in use by this allocator
UInt64 size = g_EnlightenAlloc->GetTotalMemoryInUse();
printf_console("g_EnlightenAlloc->GetTotalMemoryInUse(): %llu\n", size);
each frame. Over muliple scene loads you can see the memory usage going up
2. How we can reproduce it using the example you attached
1) Build the sample to a debugable PC standalone build.
2) Set breakpoints in UnityGPUTextureUpdater::Create() and UnityGPUTexture::Create() and verify they are being created each time realtimeGI.unity is loaded but that UnityGPUTextureUpdater::Release() and UnityGPUTexture::Release() are never called to release the memory.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [Linux Hub] A new instance of the Hub does not have a Taskbar icon
- Mesh Inspector becomes slow to use when inspecting a large Mesh with Blend Shapes
- [Metal] GfxDeviceMetal::CreateComputeProgram does not check inputs
- The Modes button of the the SerializedField MinMaxGradient is not clickable in the Inspector when indentLevel is more than 0
- Input.GetKey for Left Shift returns true when Right Shift is held down and Left Shift is pressed (and vice versa)