Search Issue Tracker
Won't Fix
Votes
0
Found in
2017.4
2018.4.2f1
2020.1
Issue ID
1223324
Regression
No
Constantly creating and destroying CharacterController component causes a memory leak
How to reproduce:
1. Open attached project (1223324.zip)
2. Enter Play Mode
3. Open task manager and find the Unity.exe process
4. Observe how the process memory usage changes
Expected result: The Unity process memory usage doesn't change much
Actual result: The Unity process memory usage is quickly going up
Reproducible with: 2017.4.37f1, 2018.4.18f1, 2019.3.3f1, 2020.1.0a25, 2020.2.0a1
Notes:
1. Other components like a BoxCollider and an empty script were also tested in the same scenario and did not produce any significant changes in memory usage
2. The Visual Studio Debugger can also be used to track memory usage changes by attaching the Unity process using (Menu bar: Debug > Attach to process...) and selecting the Unity.exe from the given list, then opening the "Memory Usage" tab, enabling "Heap Profiling" and taking a snapshot every few seconds
3. If the "Test" script (that is constantly creating and destroying CharacterController components) is disabled the process memory usage does not drop by more than a few megabytes
4. Tested on a Windows 10 PC and Mac (in Editor and Build)
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
- RenderDoc Capture Frame can't be completed after Particle System is simulated
- Editor crashes when attempting to connect the client machine to the host machine
- CameraDepthTexture is flipped upside down when URP is rendering without the final blit
- Camera.current returns null when Camera.targetTexture is set to null in OnPostRender
- Crash on BaseHierarchyProperty::Next when opening a specific project
Resolution Note:
Closing this case as won't Fix because this is not a proper usage of character controller and not a frequent use case either. Very little games would require creating and destroying character controller thousands of time a second for a while.