Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2018.4.12f1
2019.4
2020.2
2021.1
2021.2
Issue ID
1299940
Regression
No
Memory leak when filling a Scriptable Object with at least 5 MB
How to reproduce:
1. Open the attached project ("BigScriptable2.zip")
2. Assets > Create > Scriptable Objects > SpawnManagerScriptableObject
3. Keep track of memory usage
4. Memory usage shoots up
5. Select some different object so the SO is not selected
6. Memory used by Unity shoots up even more (even though the Scriptable Object used in the repro is 50MB) (only happens from 2020.2)
7. Delete the Scriptable Object
Expected results: Memory usage grows and shrinks proportionately to the Scriptable Objects created/deleted
Actual results: Memory usage grows and shrinks not proportionately to the Scriptable Objects created and does not go down when the Scriptable Objects are deleted
Reproducible with: 2018.4.31f1, 2019.4.18f1, 2020.2.3f1, 2021.1.0b3, 2021.2.0a2
Notes: from 2020.2 Memory usage shoots a lot more when selecting a different object after creating the SO asset
When the ScriptableObject is selected, the Editor becomes really slow and unresponsive
-
Sprawl
Feb 07, 2021 20:14
For those interested in this issue, a very similar active bug can be found here : https://issuetracker.unity3d.com/issues/editor-becomes-unresponsive-and-performance-is-continually-degraded-when-selecting-a-scriptable-object-with-a-large-dataset
-
Sprawl
Feb 02, 2021 14:29
Based on the first sentence of the Scriptable Object documentation, they are made to save *large* amounts of data. The resolution of this issue seems to contradict this.
If scriptables objects are not the way to store data that might scale, what's the way Unity recommends ?
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
- TMP Text size does not adjust after Superscript Rich Text tag when using Fallback fonts
- Unexpected behaviour when selecting items in UI Toolkits TreeView sample
- C# Script Help button leads to missing documentation
- Root GameObject behaves differently when blending animations with and without keyframes and using AnimationPlayable
- Crash on D3D12GetInterface when reopening a specific project
Resolution Note:
Constant increase in memory usage not found (which is the main symptom of a memory leak). The memory increase is due to duplicated memory - both on the native and managed side. Once the managed heap has grown in size, it does not shrink, a percentage of the memory is just not used (or used for other means).
The other issue that I could produce however was the hang when selecting the ScriptableObject with the large serialised dataset, this is indeed not the designed usage for ScriptableObjects and is therefore by design.