Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2018.4
2019.4
2020.2
2020.2.0f1
2021.1
2021.2
Issue ID
1303095
Regression
No
Memory of non persistent event listeners isn't cleared when calling UnityEventBase.RemoveAllListeners
How to reproduce:
1. Open the attached "1303095 repro" project
2. Open the "SampleScene" Scene from the Assets folder
3. Open the Profiler window from Window > Analysis > Profiler
4. Open the Memory module of the Profiler
5. Enter Play Mode
Expected results: the GC Used Memory is around 25MB
Actual results: the GC Used Memory is around 515MB
Reproducible with: 2018.4.30f1, 2019.4.17f1, 2020.2.1f1, 2021.1.0b2, 2021.2.0a1
Notes:
-The issue reproduces with both Mono and IL2CPP Scripting Backends and with both .NET Standard 2.0 and .NET 4.x API Compatibility Levels
-If the "Should Clear" checkbox is checked on the "Sample Script", the memory will be released after invoking the event with 0 listeners
-The issue can also be observed in the Console window with the Debug messages printing the results of GC.GetTotalMemory()
-The issue is present in the Editor and a built project
- GC.Collect() doesn't free up any memory even after removing all listeners
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
- Reflection Probe “Probe Scene Editing Mode:” text is barely visible
- [HDRP] Game view doesn’t refresh after changing Camera Background Type until mouse moves over it
- Some Shaders appear twice in Material Shader selection menu
- Editor freezes with a StackOverflowException when certain asset types are assigned to a managed component in a SubScene via AddComponentObject
- Text Script Importer Reference button links to a Missing Page when clicking the Reference Button in the Inspector
Resolution Note (fix version 2021.2):
Fixed in 2021.2.0a14