Search Issue Tracker
Won't Fix
Votes
1
Found in
2018.4
2018.4.13f1
Issue ID
1219233
Regression
No
Temp Alloc in mono Heap won't be GCed
Steps to reproduce:
1. Open and Play the user-supplied project
2. Inspect the mono allocated memory in the top right.
3. Press the top button, then the middle one, wait for 10 seconds.
4. Press the bottom button.
Expected: the memory returns to the state before pressing the first button
Actual: the memory does not fully return
Reproduced in: 2018.4.17f1
Not reproduced in: 2017.4.37f1 (scene breaks), 2019.2.0a1, 2019.2.21f1, 2019.3.2f1, 2020.1.0a23
I can't find a duplicate so I am making a report for 2018.4
Note: reproducible with .NET 4.x
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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
Resolution Note:
The root cause of this issue is from performing large (~10MB) allocations in a 32 bit operating space. I've been able to reproduce the behavior in mono and 32bit il2cpp runtimes but not with the 64bit il2cpp runtime. This is a known deficiency of the bdwgc (garbage collector) and the recommended fix is to use a 64bit runtime. The reason this issue occurs is because when a large allocation occurs there is a random chance that there is some non-pointer value on the stack that just happens to point to the memory in question where the large allocation lives, thus causing the garbage collector to incorrectly preserve it in memory instead of cleaning it up as you would expect.