Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: ISXB-953 InputSystemProvider GC Alloc #1973

Merged
merged 4 commits into from
Jul 31, 2024

Conversation

benoitalain
Copy link
Collaborator

@benoitalain benoitalain commented Jul 29, 2024

Description

Jira ticket: https://jira.unity3d.com/browse/ISXB-953

Fixes memory allocated every frame when using InputForUI with InputSystem package, i.e. when using a UIDocument without an EventSystem.

Changes made

  • Fixed the memory allocation.
  • Added a unit test InputForUITests.Update_DoesntAllocate that fails without the fix and passes with it.
  • Updated CHANGELOG.md

Testing

Manually tested the repro project profiler evidence, and the fix. Added a unit test.

Risk

Very low risk. Change is a one-liner, simple and only has a local impact.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

Copy link
Collaborator

@jfreire-unity jfreire-unity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 🎉 and thanks for the unit test 🙏

@@ -127,7 +127,7 @@ public void Update()
// This is necessary to ensure that events are dispatched in the correct order.
// If all events are of the PointerEvents type, sorting is based on reverse order of the EventSource enum.
// Touch -> Pen -> Mouse.
m_Events.Sort(SortEvents);
m_Events.Sort((a, b) => SortEvents(a, b));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So using a lambda expression here doesn't allocate like mentioned in the forums? Interesting learning!

@Pauliusd01 Pauliusd01 merged commit 084bf22 into develop Jul 31, 2024
76 of 79 checks passed
@Pauliusd01 Pauliusd01 deleted the isxb-953-inputsystemprovidergcalloc branch July 31, 2024 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants