Also record retain() and release()

This commit is contained in:
Trustin Lee 2013-12-06 13:44:59 +09:00
parent 6554b8c395
commit d21568b962

View File

@ -671,11 +671,25 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
return super.toString(index, length, charset); return super.toString(index, length, charset);
} }
@Override
public ByteBuf retain() {
leak.record();
return super.retain();
}
@Override
public ByteBuf retain(int increment) {
leak.record();
return super.retain(increment);
}
@Override @Override
public boolean release() { public boolean release() {
boolean deallocated = super.release(); boolean deallocated = super.release();
if (deallocated) { if (deallocated) {
leak.close(); leak.close();
} else{
leak.record();
} }
return deallocated; return deallocated;
} }
@ -685,6 +699,8 @@ final class AdvancedLeakAwareByteBuf extends WrappedByteBuf {
boolean deallocated = super.release(decrement); boolean deallocated = super.release(decrement);
if (deallocated) { if (deallocated) {
leak.close(); leak.close();
} else {
leak.record();
} }
return deallocated; return deallocated;
} }