This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch branch-4.7
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.7 by this push:
     new 8100719  Use unpooled buffers in BufferedChannel
8100719 is described below

commit 81007191be712c49f3a303e099092bfdcb633404
Author: Matteo Merli <[email protected]>
AuthorDate: Mon Jun 4 13:11:44 2018 -0700

    Use unpooled buffers in BufferedChannel
    
    This is a safer fix for #1414 to be included in 4.7.1.
    
    Use unpooled buffer to avoid mem leak in entry log rotation.
    
    Author: Matteo Merli <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Jia Zhai <None>, Sijie 
Guo <[email protected]>
    
    This closes #1469 from merlimat/fix-entry-log-rotation
---
 .../src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
index 05a20e5..a9c0baa 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/BufferedChannel.java
@@ -22,7 +22,7 @@
 package org.apache.bookkeeper.bookie;
 
 import io.netty.buffer.ByteBuf;
-import io.netty.buffer.ByteBufAllocator;
+import io.netty.buffer.Unpooled;
 
 import java.io.Closeable;
 import java.io.IOException;
@@ -78,7 +78,7 @@ public class BufferedChannel extends BufferedReadChannel 
implements Closeable {
         this.writeCapacity = writeCapacity;
         this.position = new AtomicLong(fc.position());
         this.writeBufferStartPosition.set(position.get());
-        this.writeBuffer = 
ByteBufAllocator.DEFAULT.directBuffer(writeCapacity);
+        this.writeBuffer = Unpooled.buffer(writeCapacity);
         this.unpersistedBytes = new AtomicLong(0);
         this.unpersistedBytesBound = unpersistedBytesBound;
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to