Repository: activemq-artemis
Updated Branches:
  refs/heads/master 12e746528 -> 095ce777d


ARTEMIS-1223 OutOfDirectMemoryError raised from TimedBuffer

Force allocation of direct ByteBuffer with Cleaner to help GC on tests.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/9f8a1444
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/9f8a1444
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/9f8a1444

Branch: refs/heads/master
Commit: 9f8a14440bd39d061da18495cbdac58a24aa9db3
Parents: 12e7465
Author: Francesco Nigro <[email protected]>
Authored: Tue Jun 27 11:47:44 2017 +0200
Committer: Clebert Suconic <[email protected]>
Committed: Tue Jun 27 12:45:26 2017 -0400

----------------------------------------------------------------------
 .../org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9f8a1444/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
----------------------------------------------------------------------
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
index ca9a315..238568f 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java
@@ -100,7 +100,9 @@ public final class TimedBuffer {
       }
       // Setting the interval for nano-sleeps
       //prefer off heap buffer to allow further humongous allocations and 
reduce GC overhead
-      buffer = new ChannelBufferWrapper(Unpooled.directBuffer(size, size));
+      //NOTE: it is used ByteBuffer::allocateDirect instead of 
Unpooled::directBuffer, because the latter could allocate
+      //direct ByteBuffers with no Cleaner!
+      buffer = new 
ChannelBufferWrapper(Unpooled.wrappedBuffer(ByteBuffer.allocateDirect(size)));
 
       buffer.clear();
 

Reply via email to