Search Issue Tracker
Fixed in 1.3.4
Votes
0
Found in [Package]
1.1.0
Issue ID
1214752
Regression
No
Memory is not cleared after loading an empty Scene with SceneLoadMode.Single, calling GC.Collect and Resources.UnloadUnusedAsset
How to reproduce:
1. Open attached project "leakTest2019.3.0f3.zip"
2. Build and Run the project
3. In Editor, open Memory Profiler window
4. Take a snapshot and observe it
5. In Build, press "Space" (this will unload the resources and load an empty scene)
6. Repeat steps 3 and 4
Expected result: the snapshot memory size is different (step 6 should have less memory allocated)
Actual result: the snapshot memory size is the same
Reproducible with: 2019.1.9f1 (memory profiler prev.9 - 0.1.0), 2019.2.20f1, 2019.3.0f6, 2020.1.0a21
Not reproducible with: 2018.4.16f1 (memory profiler prev.9 - 0.1.0)
Could not test with: 2017.4 (package manager is not implemented, hard to check specific memory allocations), 2019.1.0a1-2019.1.8f1 a lot of different issues (errors in console window, Editor freezing after opening SampleScene, Memory Profiler stuck on creating a capture window after Capture Player is pressed)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Silent crash when clicking in Scene View in a specific project
- The Player renders black on a Quest headset when MSAA, Post Processing, and Spacewarm depth submission are enabled
- Graphics Compositor breaks Unity rendering when the "Output Camera" is changed to a scene Camera and one Camera SubLayer is active
- The Editor freezes on RenderGraphViewer.Repaint when entering too many characters in search fields without character limits
- Adding a new SubLayer in Graphics Compositor renders BaseLayer darker and makes it flicker
Resolution Note (fix version 1.3.4):
Playable graphs will release their assets at the end of the frame, in order to safely terminate the graph.
Then GC needs to run in order for the refcount on the Assets to go to zero.
Then UnloadUnusedAssets needs to run in order to unload the assets.
All of this needs to be done in a script outside of the scene being unloaded, because coroutines will stop running at the end of the frame, because the object has been unloaded.