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
- Inspector's custom tooltip is displayed incorrectly when the name is truncated in UI toolkit
- Crash on ScriptableRenderLoopDraw when rendering a specific VFX in Play Mode
- The script is not renamed in the Project window when renaming and a compilation Error is present
- Average FPS in Play Mode degradation on a newly created BiRP project when it's upgraded from 2020.3.48f1 to a newer Editor version
- DecoratorDrawer indentation is incorrect when it is called with EditorGUI
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.