Skip to content

Commit

Permalink
NO-JIRA releaseBufferMemory just in case
Browse files Browse the repository at this point in the history
This is just to make releaseBuffer to have the same semantic when no pool is used.

This has no effect on how the broker behaves as we always have it pooled.
  • Loading branch information
clebertsuconic committed Dec 8, 2022
1 parent bfb33c7 commit 44cec59
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ public ByteBuffer allocateDirectBuffer(final int size) {

@Override
public void releaseDirectBuffer(ByteBuffer buffer) {
PlatformDependent.freeDirectBuffer(buffer);
if (buffer.isDirect()) {
PlatformDependent.freeDirectBuffer(buffer);
}
}

@Override
Expand All @@ -155,6 +157,8 @@ public ByteBuffer newBuffer(int size, boolean zeroed) {
public void releaseBuffer(ByteBuffer buffer) {
if (this.bufferPooling) {
bytesPool.release(buffer);
} else {
releaseDirectBuffer(buffer);
}
}

Expand Down

0 comments on commit 44cec59

Please sign in to comment.