Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.39f1

2022.3.31f1

6000.0.4f1

Issue ID

UUM-72857

Regression

No

Freeze when spawning a Prefab while in Play Mode

--

-

Reproduction steps:
1. Open the attached “repro_IN-76097“ project
2. Watch the attached video for the pattern that you need to press
3. Observe a freeze

Reproducible with: 2021.3.39f1, 2022.3.31f1, 6000.0.4f1

Reproducible on: Windows 10 (22H2)
Not reproducible on: No other environments tested

Notes:

* Reproducible in Player
* When the freeze occurs, memory leak can be observed, which can cause a “Could not allocate memory: System out of memory!“ error and a crash if the PC doesn’t have a lot of RAM
* Was not able to reproduce the crash (with 64 GB of RAM)
* User was able to reproduce the crash

  1. Resolution Note:

    The out of memory error is caused by the script of "WinCon.cs" entering a state where "collisionCounterCircle >= requiredCollisions" is true where two objects are instantiated. Unfortunately, "collisionCounterCircles" is never reset so this condition is true forever resulting in the continuous creation of objects until memory runs out. At some point, because physics is dealing with more and more objects it asks for more memory which is refused and triggers an out-of-memory assert.

    The error here is in the script logic creating too many objects without limit.

    This was quickly found by debugging the project, placing a breakpoint where instantiate happens. In the future I would recommend following the debugging guide so issues lik this can quickly be found:

    https://docs.unity3d.com/Manual/ManagedCodeDebugging.html

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.