Search Issue Tracker
Won't Fix
Votes
0
Found in [Package]
1.1.0-pre.5
Issue ID
1338934
Regression
No
Fair amount of garbage is allocated when using Input System
1. Open the attached project "InputSystemGC2.zip"
2. Open the "SampleScene" Scene
3. Open Profiler (Window > Analysis > Profiler)
4. Enter Play Mode
5. Make sure the Module details panel is in Hierarchy view and the "Live" button is toggled on
6. Hold the left mouse button in the Game view
7. While holding the left mouse button look at the Profiler window
Expected result: No garbage or less garbage gets created
Actual result: Some garbage is created
Reproducible with: 1.0.0 (2019.4.28f1, 2020.3.13f1), 1.1.0-pre.5 (2019.4.28f1, 2020.3.13f1, 2021.1.14f1, 2021.2.0b2, 2022.1.0a1)
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:
I analyzed the provided deep profile and as highlighted in provided screenshots there is managed dynamic memory allocation happening in frame 74 as clearly stated in this case. Drilling down into the callstack starting from PreUpdate.NewInputUpdate() as root, its possible to see that the dynamic allocation originates from UnityEvent and Mono.JIT as previously elaborated on. However, looking into subsequent frames, e.g. 75, 76, 77 etc GC alloc is zero, i.e. its possible to see that no additional GC Alloc is performed. Stepping forward its visible that any GC Alloc is also either driven by UnityEvent or Mono.JIT. UnityEvents are used for callbacks from the input framework but is outside the implementation of the Input system itself.