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
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
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.