ARTEMIS-1223 OutOfDirectMemoryError raised from TimedBuffer

Force allocation of direct ByteBuffer with Cleaner to help GC on tests.
This commit is contained in:
Francesco Nigro 2017-06-27 11:47:44 +02:00 committed by Clebert Suconic
parent 12e7465283
commit 9f8a14440b
1 changed files with 3 additions and 1 deletions

View File

@ -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();