GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||
GeezerVison is showing github.com — allocation free AdaptiveByteBuf::setBytes(byte[]) by franz1981 · Pull Request #16058 · netty/netty Conversation
Contributor
Motivation: Modification: Result:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: The adaptive buffer's setBytes(byte[]) method requires the underlying internal NIO buffer to be materialized, but temporary buffers (which won't get flushed to the network) are not granted to have it, causing an unwanted allocation Modification: Java 13 expose ad-hoc method which allow using the root parent NIO buffer, saving materializing the internal NIO buffer. Result: Cheaper setBytes
franz1981
commented
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part is not tested
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
normanmaurer
approved these changes
yawkat
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hasAbsolutePutArrayMethod instead of javaVersion, maybe?
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
yawkat
approved these changes
chrisvest
approved these changes
chrisvest
pushed a commit
to chrisvest/netty
that referenced
this pull request
Motivation: The adaptive buffer's setBytes(byte[]) method requires the underlying internal NIO buffer to be materialized, but temporary buffers (which won't get flushed to the network) are not granted to have it, causing an unwanted allocation Modification: Java 13 expose ad-hoc method which allow using the root parent NIO buffer, saving materializing the internal NIO buffer. Result: Cheaper setBytes (cherry picked from commit 3cae6f6)
|
There was an error while loading. Please reload this page.
|
Hi @franz1981, if I may ask regarding
Could it be that those unwanted allocations happen on heap or it's always materialized into direct buffers? I was recently getting on-heap OOM when using direct buffers and saw Copying only relevant for this PR part from the question |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@BaurzhanSakhariev it is possible but I would still be surprised unless there is some leak on the source NIO heap buffer (that's why the copy happen looking at the stack trace) which keep it referenced and prevent it to be GCd. This PR is not fixing the src side but the designation side (which receive the copy) so it is possible you were already full w the heap and the additional allocation on dst side just give the final blow |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Right, I run test with low However, that was not a good idea to cap it like that as I run tests on same JVM with my application and created many structures in test itself and had very small max heap setting. Once I start running tests with "normal" max heap and instead directly specified |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Motivation: The adaptive buffer's setBytes(byte[]) method requires the underlying internal NIO buffer to be materialized, but temporary buffers (which won't get flushed to the network) are not granted to have it, causing an unwanted allocation Modification: Java 13 expose ad-hoc method which allow using the root parent NIO buffer, saving materializing the internal NIO buffer. Result: Cheaper setBytes (cherry picked from commit 3cae6f6) Co-authored-by: Francesco Nigro <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.