Skip to content

Fill MsgHdrMemoryArray#hdrs with null entry on release#16764

Merged
normanmaurer merged 2 commits into
netty:4.2from
tsegismont:issue/16763
May 8, 2026
Merged

Fill MsgHdrMemoryArray#hdrs with null entry on release#16764
normanmaurer merged 2 commits into
netty:4.2from
tsegismont:issue/16763

Conversation

@tsegismont
Copy link
Copy Markdown
Contributor

Motivation:

See #16763

This gives GC a chance to collect entries early.
Calling release on each entry is effectively a no-op.

Modifications:

In MsgHdrMemoryArray#release, fill hdrs array with nulls instead of invoking release on every entry.

Result:

After the instance is release, the GC can collect entries (about 600kb on my machine) early.

Motivation:

See netty#16763

This gives GC a chance to collect entries early.
Calling release on each entry is effectively a no-op.

Modifications:

In MsgHdrMemoryArray#release, fill hdrs array with nulls instead of invoking release on every entry.

#Result:

After the instance is release, the GC can collect entries (about 600kb on my machine) early.
@normanmaurer normanmaurer added this to the 4.2.14.Final milestone May 7, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label May 7, 2026
@normanmaurer normanmaurer merged commit 27ca159 into netty:4.2 May 8, 2026
16 of 19 checks passed
@netty-project-bot
Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #16771

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label May 8, 2026
normanmaurer added a commit that referenced this pull request May 10, 2026
…#16771)

Auto-port of #16764 to 5.0
Cherry-picked commit: 27ca159

---
Motivation:

See #16763

This gives GC a chance to collect entries early.
Calling release on each entry is effectively a no-op.

Modifications:

In MsgHdrMemoryArray#release, fill hdrs array with nulls instead of
invoking release on every entry.

Result:

After the instance is release, the GC can collect entries (about 600kb
on my machine) early.

Co-authored-by: Thomas Segismont <tsegismo@ibm.com>
Co-authored-by: Norman Maurer <norman_maurer@apple.com>
Co-authored-by: Chris Vest <christianvest_hansen@apple.com>
@tsegismont tsegismont deleted the issue/16763 branch May 11, 2026 12:37
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