Skip to content

Conversation

@surajdarade
Copy link
Contributor

@surajdarade surajdarade commented Dec 10, 2025

Fixes #2962 [ Enhancement/Optimization ]

Clean MemoryPool implementation at NetworkReceive:

  • Lazy creation of buffer via MemoryPool
  • readFrom() - Allocation Failure - return head (prevent attempt to a payload without memory)
  • readFrom() - Readable execution flow
  • close() - Buffer ownership optimization - removed buffer != EMPTY_BUFFER (before buffer was not allocated through the MemoryPool, now being allocated through MemoryPool, MemoryPool now becomes single owner for all payload buffers)

…er pool and tiered bucket allocation for commonpayload sizes to reduce GC overhead and memory fragmentation.
@surajdarade
Copy link
Contributor Author

Any update on this? @superhx , @Gezi-lzq

@superhx
Copy link
Collaborator

superhx commented Dec 15, 2025

@surajdarade Thank you for your PR. The expectation of the ISSUE is to add a new MemoryPool implementation to optimize the memory usage of NetworkReceive.

@surajdarade
Copy link
Contributor Author

Thanks for redirecting. Will refactor as per the intended requirement now.

…ted via MemoryPool, returning head in allocation failure preventing payload read without memory
@surajdarade
Copy link
Contributor Author

Have a look on this proposed optimization, let me know what can we improved, what revamp is needed.

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.

[Feature Request]Optimize the memory allocation of NetworkReceive

2 participants