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.
- [Vulkan] Wrong aspect ratio in fullscreen of Standalone build when selected screen resolution is not native
- [iOS 12] [Metal] IOAF code 4 error freeze because of tessellation shader
- 'A tree couldn't be loaded because the prefab is missing' error is thrown when importing package with Terrain Asset with Trees
- [Mac] Crash on ioAccelResourceListAddNewGroupAndResource when importing a large COLLADA model
- Prefab referenced Game Object is not removed from the Scene files when the reference field gets deleted