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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
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.