-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Cleanup fields on AdaptiveByteBuf::deallocate #14273
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
@franz1981 you need to add a null check and throw
|
I've done it but still getting an ex; investigating... |
Motivation: AdaptiveByteBuf::deallocate is not cleaning up both its wrapped ByteBuf and Chunk, extending their lifecycles (if they can be GCed) till AdaptiveByteBuf is reused again Modifications: Clean the relevant fields of AdaptiveByteBuf on deallocation Result: No more (temporary) memory leak
74a787f
to
2101055
Compare
@normanmaurer PTAL Not the best possible way to solve it, but I've decided to have 2 fields (in theory one was sufficient, but still...using Java Object Layout plugin for IDEA didn't show up any advantage in term of Object size...) which are "sticky" i.e. even if the object is deallocated, to respect the existing contract for |
Motivation: AdaptiveByteBuf::deallocate is not cleaning up both its wrapped ByteBuf and Chunk, extending their lifecycles (if they can be GCed) till AdaptiveByteBuf is reused again Modifications: Clean the relevant fields of AdaptiveByteBuf on deallocation Result: No more (temporary) memory leak
@normanmaurer should I open this for 4.2? Wdyt of using the GH stuff we talked about for automatic backporting? |
I already cherry-picked it |
u're a star, thanks bud @normanmaurer |
Motivation:
AdaptiveByteBuf::deallocate is not cleaning up both its wrapped ByteBuf and Chunk, extending their lifecycles (if they can be GCed) till AdaptiveByteBuf is reused again
Modifications:
Clean the relevant fields of AdaptiveByteBuf on deallocation
Result:
No more (temporary) memory leak