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
- “FocusController has unprocessed focus events.” warnings are thrown after adding iOS, tvOS or visionOS Build Profiles
- Holes and different colors appear on default Tree Materials after applying them to the Tree GameObject and undoing changes
- Error indicating that the Text Asset Importer hasn't been disposed properly is logged when switching Importer Type in a Focused Inspector
- Documentation installation shows "Install failed: Validation Failed" when installing Android Build Support module
- Error indicating that the Package Manifest Importer hasn't been disposed properly is logged when switching Importer Type in a Focused Inspector
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.