Skip to content

fix: Message sending GC allocations - #4119

Merged
EmandM merged 6 commits into
develop-2.0.0from
fix/gc-allocs
Aug 11, 2026
Merged

fix: Message sending GC allocations#4119
EmandM merged 6 commits into
develop-2.0.0from
fix/gc-allocs

Conversation

@EmandM

Copy link
Copy Markdown
Member

Purpose of this PR

Fixes some GC allocations in message hot paths.

Jira ticket

fixes: #4091

Changelog

  • Fixed: Resolved GC allocations in some hot paths

Documentation

  • No documentation changes or additions were necessary.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Up-port

Up-port needed

Backports

n/a

@EmandM
EmandM requested a review from a team as a code ownerAugust 7, 2026 16:35
@codecov-github-com

codecov-github-comBot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing linesPatch %Lines
...eobjects/Runtime/Messaging/Messages/RpcMessages.cs0.00%2 Missing ⚠️
@@ Coverage Diff @@## develop-2.0.0 #4119 +/- ##
=================================================
+ Coverage 73.88% 73.94% +0.06% 
=================================================
Files 172 172 Lines 28095 28099 +4 =================================================
+ Hits 20758 20779 +21 + Misses 7337 7320 -17 
FlagCoverage Δ
NGOv2_project_testproject_ubuntu_pinnedTrunk73.65% <93.33%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing linesCoverage Δ
.../Messaging/Messages/NetworkVariableDeltaMessage.cs77.92% <100.00%> (ø)
...objects/Runtime/Messaging/NetworkMessageManager.cs82.39% <100.00%> (ø)
...netcode.gameobjects/Runtime/Metrics/MetricHooks.cs100.00% <100.00%> (ø)
...Runtime/NetworkVariable/Collections/NetworkList.cs79.75% <100.00%> (-0.07%)⬇️
...ode.gameobjects/Runtime/Serialization/BitReader.cs94.23% <100.00%> (ø)
...eobjects/Runtime/Serialization/FastBufferReader.cs80.03% <100.00%> (ø)
...eobjects/Runtime/Messaging/Messages/RpcMessages.cs42.61% <0.00%> (+0.94%)⬆️

... and 1 file with indirect coverage changes

ComponentsCoverage Δ
com.unity.netcode.gameobjects73.94% <93.33%> (+0.06%)⬆️

ℹ️ Need help interpreting these results?

@NoelStephensUnityNoelStephensUnity left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!
👍

@EmandM
EmandM merged commit 3d9f18a into develop-2.0.0Aug 11, 2026
26 checks passed
@EmandM
EmandM deleted the fix/gc-allocs branch August 11, 2026 20:03
michalChrobot added a commit that referenced this pull request Aug 31, 2026
* fix: Message sending GC allocations (#4119)
* fix: GC allocations
* Add message receive allocations test
* Revert the fix to check ILPP build fails the test
* Revert forced failure
* Remove gc checks on NetworkListTests
* ci: re-enable PS5 and Switch jobs (#4117)
* Re-enabled ps5 and webgl
* ci: Add WebGL PlayMode test job (MTT-15569)
Split the WebGL CI into a build phase and a run phase. webgl-build.yml
now exposes the built player as a dedicated 'players' artifact, and a new
webgl-test.yml run job consumes it and executes the PlayMode tests inside
Firefox on a GPU-backed Ubuntu agent (Unity::VM::GPU, rtx2080). The Firefox
browser flags are passed explicitly so UTR does not attempt to download the
browser from Stevedore.
The run job is wired into the Nightly and Weekly (QV) triggers only, not
into PR triggers, since WebGL failures are infrequent and the build is slow.
Runtime RuntimePlatform.WebGLPlayer exclusions are intentionally deferred to
be added reactively after the first real CI run.
* corrected images
* disabled webgl test
* adjustments
* Removed WebGL changes
* reverted change
* added diagnostic for switch
* corrected Switch sdk version
* temporarily disabled switch
* corrected ticket description
* chore: Updated aspects of Netcode package in anticipation of v2.13.2 release (#4121)
* ci: Add pets-svc to pr-description-check exclusion list (#4125)
Changde users exclusion to pattern exclusion in pr description check
* trunk shadow changes: com.unity.netcode.gameobjects (#4120)
* Updated changelog and package version for Netcode in anticipation of v2.13.1 release
* typo in build automation
* trunk shadow changes: com.unity.netcode.gameobjects [skip ci]
* Revert CHANGELOG changes
* Added UNITY_TEST_FRAMEWORK_1_7_OR_NEWER guard and UnityCoreClrExplicitDisabledAttributeShim.cs to make attribute usage possible
* corrected svc bot exclusion
---------
Co-authored-by: netcode-automation <svc-netcode-sdk@unity3d.com>
Co-authored-by: Michał Chrobot <michal.chrobot@unity3d.com>
Co-authored-by: PETS automation <299490404+pets-svc[bot]@users.noreply.github.com>
Co-authored-by: Emma <emma.mcmillan@unity3d.com>
* chore(deps): update ci deps updates (#4085)
Co-authored-by: unity-renovate[bot] <120015202+unity-renovate[bot]@users.noreply.github.com>
* fixed CI + addressed U-PR comments
---------
Co-authored-by: Emma <emma.mcmillan@unity3d.com>
Co-authored-by: Netcode team bot <svc-netcode-sdk@unity3d.com>
Co-authored-by: pets-svc[bot] <299490404+pets-svc[bot]@users.noreply.github.com>
Co-authored-by: unity-renovate[bot] <120015202+unity-renovate[bot]@users.noreply.github.com>
Sign up for freeto 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.

Lot of GC when receive and send messages

3 participants

@EmandM@ShadauxCat@NoelStephensUnity