Memory leak in Canvas/ UI System

Almost two weeks ago I found a memory leak in my program. If I use Destroy on a canvas Unity will not free the memory. If I keep destroying and recreating canvas’s it will use more and more memory until the application crashes.

This seems to be a massive bug to me and the 5.2 update doesn’t solve it. I reported the bug almost 2 weeks ago still nothing happened. Currently, my work around is pooling everything that contains a canvas as good as possible :confused: still hoping it gets fixed properly!

Is there anything I can do to get this fixed?

2 weeks is not a lot of time. We currently have over 150 bugs assigned to our team. I dont even know if your bug has made it passed the QA verification and has reached us. You’ll need to give it more time

We found memory leak if you destroy Canvas with children (U 5.2.0 - 5.3.0). It looks like the workaround is destroy all children before destroying Canvas.

did you report a bug?

Have a similar problem with a prefab with UI Image and UI Text. I load the prefab from an asset bundle. The Image has a sprite from at atlas within the asset bundle. The text has a font from the Assets folder (not in asset bundle).

When I exit the scene, destroy the instantiated object of the prefab, and use Resources.UnloadUnusedAssets, the prefab and atlas remains in memory. WHY? This is due to the Text using a font that exists in Assets, it somehow keeps a reference to the prefab alive, thus all references within the prefab remain in memory.

Note: References to prefab are somehow static, even when you stop the simulator in unity, the references will still show up in the memory detailed profiler view.