Search Issue Tracker

Won't Fix



Found in



Issue ID




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

  1. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.