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
[#4017] Implement proper resource leak detection for CompositeByteBuf #4713
Conversation
Motivation: CompositeByteBuf only implemented simple resource leak detection and how it was implemented was completly different to the way it was for ByteBuf. The other problem was that slice(), duplicate() and others would not return a resource leak enabled buffer. Modifications: - Proper implementation for all level of resource leak detection for CompositeByteBuf Result: Proper resource leak detection for CompositeByteBuf.
@Scottmitch @trustin @nmittler PTAL |
@@ -50,6 +50,28 @@ protected static ByteBuf toLeakAwareBuffer(ByteBuf buf) { | |||
return buf; | |||
} | |||
|
|||
protected static CompositeByteBuf toLeakAwareBuffer(CompositeByteBuf buf) { | |||
ResourceLeak leak; | |||
switch (ResourceLeakDetector.getLevel()) { |
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.
Can the level change? If not, would it be make sense to save off some sort of allocator for the leak aware buffers?
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.
Yes it can change
@normanmaurer +1 this was badly needed! :) Took a first pass ... just a few minor comments. Looks great! |
LGTM. Great job! |
@normanmaurer - lgtm ... great work! |
Motivation:
CompositeByteBuf only implemented simple resource leak detection and how it was implemented was completly different to the way it was for ByteBuf. The other problem was that slice(), duplicate() and others would not return a resource leak enabled buffer.
Modifications:
Result:
Proper resource leak detection for CompositeByteBuf.