Skip to content
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

Record release when enable detailed leak detection #6972

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions buffer/src/main/java/io/netty/buffer/AdvancedLeakAwareByteBuf.java
Expand Up @@ -931,6 +931,18 @@ public ByteBuf retain(int increment) {
return super.retain(increment);
}

@Override
public boolean release() {
leak.record();
return super.release();
}

@Override
public boolean release(int decrement) {
leak.record();
return super.release(decrement);
}

@Override
public ByteBuf touch() {
leak.record();
Expand Down
Expand Up @@ -1017,6 +1017,18 @@ public CompositeByteBuf retain(int increment) {
return super.retain(increment);
}

@Override
public boolean release() {
leak.record();
return super.release();
}

@Override
public boolean release(int decrement) {
leak.record();
return super.release(decrement);
}

@Override
public CompositeByteBuf touch() {
leak.record();
Expand Down
Expand Up @@ -98,7 +98,7 @@ public ByteBuf touch(Object hint) {
}

@Override
public final boolean release() {
public boolean release() {
if (super.release()) {
closeLeak();
return true;
Expand All @@ -107,7 +107,7 @@ public final boolean release() {
}

@Override
public final boolean release(int decrement) {
public boolean release(int decrement) {
if (super.release(decrement)) {
closeLeak();
return true;
Expand Down
Expand Up @@ -31,7 +31,7 @@ class SimpleLeakAwareCompositeByteBuf extends WrappedCompositeByteBuf {
}

@Override
public final boolean release() {
public boolean release() {
// Call unwrap() before just in case that super.release() will change the ByteBuf instance that is returned
// by unwrap().
ByteBuf unwrapped = unwrap();
Expand All @@ -43,7 +43,7 @@ public final boolean release() {
}

@Override
public final boolean release(int decrement) {
public boolean release(int decrement) {
// Call unwrap() before just in case that super.release() will change the ByteBuf instance that is returned
// by unwrap().
ByteBuf unwrapped = unwrap();
Expand Down