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
- Active quality level set on a new Universal 2D project is not the default quality level when creating a new project
- Inspector Open button does nothing when navigating to a different folder with a locked asset
- Pre-generated XML serializers fail to deserialize types that use polymorphism when the Player is built with the IL2CPP scripting backend
- Editor crashes with error "Failed to present D3D11 swapchain due to device reset/removed" and Player freezes when rendering a particle system while using modified URP package on DX11
- Crash on Scripting::LogException when async HTTP callback executes after scripting domain teardown
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.