Search Issue Tracker

Fixed in Unity 2018.2

Votes

0

Found in

2018.2.0a3

Issue ID

1007945

Regression

No

[Enlighten] Memory leak. UnityGPUTexture and UnityGPUTextureUpdater objects are being leaked

Global Illumination

-

-

Priority: 2Necessary for shipping a final release

-

Severity: 2Core functionality majorly impacted

[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.