Search Issue Tracker
By Design
Votes
1
Found in
2018.1.0a1
2019.2.19f1
2019.3
2020.2
Issue ID
1217907
Regression
Yes
Memory is not deallocated immediately after Texture2D object was deleted
Reproduction steps:
1. Open the attached case "case_1217907"
2. Click on the "Test" > "Texture Memory Test" in the menu bar
3. Open Windows Task Manager
4. Observe Unity Editor's Memory consumption in the Task Manager
Expected result: memory usage does increase drastically
Actual result: memory usage increases by a lot which sometimes leads to a fatal error: system out of memory
Reproducible with: 2018.1.0a1, 2018.4.18f1, 2019.3.5f1, 2020.1.0b1, 2020.2.0a2
Not reproducible with: 2017.4.37f1
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
- [Discussions] "NativePassData.GraphPasses()" has GC Alloc of ~256 B when using Render Pass
- Setting Shader Graph to Surface Type "Transparency" and Render Face "Both" breaks the preview
- Warning "Unknown pseudo class "multiline"" is logged when the Animator is loaded or in use after picking Motion in a States Inspector
- Deleting the property in the Blackboard and then creating the different type property with the same name throws an error
- Selector gets stuck in UI if scroll is used while dragging
Resolution Note (2020.2.X):
After loading a texture the data is uploaded to the GPU asynchronously. The Resources.UnloadAsset call will delete the Texture2D object but the actual texture data is kept around until the async texture upload completes. In this specific case the memory increases to an amount larger than the available memory which results in a crash. Setting the virtual memory page file in your OS larger will prevent the crash. Unfortunately we cannot handle the out of memory better at the moment. The texture operations will need to be spread over multiple frames to keep the memory usage lower. We will update the documentation to specify more clearly that the memory allocated for certain resources can be kept around longer if it is referenced by the render thread (which is the case for uploading resources).