Record release when enable detailed leak detection
Motivation: It would be easier to find where is missing release call in several retain release calls on a ByteBuf Modifications: Remove final modifier on SimpleLeakAwareByteBuf and SimpleLeakAwareByteBuf release function and override it to record release in AdvancedLeakAwareByteBuf and AdvancedLeakAwareCompositeByteBuf Result: Release will be recorded when enable detailed leak detection
This commit is contained in:
parent
f1e14d0cb2
commit
0ad99310f5
@ -931,6 +931,18 @@ final class AdvancedLeakAwareByteBuf extends SimpleLeakAwareByteBuf {
|
|||||||
return super.retain(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
|
@Override
|
||||||
public ByteBuf touch() {
|
public ByteBuf touch() {
|
||||||
leak.record();
|
leak.record();
|
||||||
|
@ -1017,6 +1017,18 @@ final class AdvancedLeakAwareCompositeByteBuf extends SimpleLeakAwareCompositeBy
|
|||||||
return super.retain(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
|
@Override
|
||||||
public CompositeByteBuf touch() {
|
public CompositeByteBuf touch() {
|
||||||
leak.record();
|
leak.record();
|
||||||
|
@ -98,7 +98,7 @@ class SimpleLeakAwareByteBuf extends WrappedByteBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean release() {
|
public boolean release() {
|
||||||
if (super.release()) {
|
if (super.release()) {
|
||||||
closeLeak();
|
closeLeak();
|
||||||
return true;
|
return true;
|
||||||
@ -107,7 +107,7 @@ class SimpleLeakAwareByteBuf extends WrappedByteBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean release(int decrement) {
|
public boolean release(int decrement) {
|
||||||
if (super.release(decrement)) {
|
if (super.release(decrement)) {
|
||||||
closeLeak();
|
closeLeak();
|
||||||
return true;
|
return true;
|
||||||
|
@ -31,7 +31,7 @@ class SimpleLeakAwareCompositeByteBuf extends WrappedCompositeByteBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Call unwrap() before just in case that super.release() will change the ByteBuf instance that is returned
|
||||||
// by unwrap().
|
// by unwrap().
|
||||||
ByteBuf unwrapped = unwrap();
|
ByteBuf unwrapped = unwrap();
|
||||||
@ -43,7 +43,7 @@ class SimpleLeakAwareCompositeByteBuf extends WrappedCompositeByteBuf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Call unwrap() before just in case that super.release() will change the ByteBuf instance that is returned
|
||||||
// by unwrap().
|
// by unwrap().
|
||||||
ByteBuf unwrapped = unwrap();
|
ByteBuf unwrapped = unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user