Search Issue Tracker
Fixed in 2018.2.X
Fixed in 2018.1.X
[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.
- When a Rigidbody2D is inactive GetPoint/GetVector/GetRelativePoint/GetRelativeVector fallbacks to returning (0, 0)
- Light brightness gets intense until the 'Lightmap Encoding' quality is changed when baking Lightmap
- Crash on LinearCollectionField::LinearCollectionField after a 'm_ArrayField != SCRIPTING_NULL' assertion when opening a project
- Import Activity Window takes long time to open
- Child Canvas' Sorting Layer is changed to the same value as the parent Canvas after interacting with Dropdown UI object