-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
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
Revert "Add PooledSlicedByteBuf and PooledDuplicatedByteBuf" #4138
Conversation
Motivation: Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled. Modifications: - revert netty#3788 Result: Less complexity, and less code to create new objects in majority of cases.
da24f87
to
a2bcd71
Compare
+1 |
I will submit a followup PR to restore changes we want (reseting the indexes, etc..) |
Motivation: As part of the revert process in netty#4138 some index and mark updates were lost. Modifications: - Restore the index / mark updates made in netty#3788 Result: Slice and Duplicate buffers index / marks are correctly initialized.
@Scottmitch while using netty .30 I noticed that pooledslicedbytebuf isn't recycled properly anyway (frame decoder = more gc pressure). I understand your findings that it needed this uncommon .release() usage to recycle properly. https://github.com/Scottmitch/netty/blob/a2bcd713d4db88dd19bcb14d9865aa506acf9710/buffer/src/main/java/io/netty/buffer/AbstractByteBuf.java#L934 - an object would be created every time so what was your motivation here? Maybe I should stop playing with these buffers and just deal with a single .copy() ... |
@ninja- - This PR fixes the complications introduced while attempting to "pool" the "derived" (slices, duplicates) taken from pooled buffers. However in most cases the pooling would never really happen and a new object would be allocated anyways because of the description of this PR. Does that answer your question? |
@Scottmitch yes thanks for explaining. I am sticking with copy instead. |
Motivation: As part of the revert process in netty#4138 some index and mark updates were lost. Modifications: - Restore the index / mark updates made in netty#3788 Result: Slice and Duplicate buffers index / marks are correctly initialized.
Motivation:
Currently the "derived" buffer will only ever be recycled if the release call is made on the "derived" object, and the "wrapped" buffer ends up being "fully released" (aka refcount goes to 0). From my experience this is not the common use case and thus the "derived" buffers will not be recycled.
Modifications:
Result:
Less complexity, and less code to create new objects in majority of cases."