Java Code Examples for io.netty.util.internal.PlatformDependent#freeDirectBuffer()
The following examples show how to use
io.netty.util.internal.PlatformDependent#freeDirectBuffer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ByteUtilTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void shouldZeroesLimitedDirectByteBuffer() { final byte one = (byte) 1; final int capacity = 64; final int bytes = 32; final int offset = 1; final ByteBuffer buffer = ByteBuffer.allocateDirect(capacity); try { fill(buffer, 0, capacity, one); buffer.limit(0); shouldZeroesByteBuffer(buffer, offset, bytes); } finally { if (PlatformDependent.hasUnsafe()) { PlatformDependent.freeDirectBuffer(buffer); } } }
Example 2
Source File: ByteUtilTest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void shouldZeroesDirectByteBuffer() { final byte one = (byte) 1; final int capacity = 64; final int bytes = 32; final int offset = 1; final ByteBuffer buffer = ByteBuffer.allocateDirect(capacity); try { fill(buffer, 0, capacity, one); shouldZeroesByteBuffer(buffer, offset, bytes); } finally { if (PlatformDependent.hasUnsafe()) { PlatformDependent.freeDirectBuffer(buffer); } } }
Example 3
Source File: PoolArena.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
@Override protected void destroyChunk(PoolChunk<ByteBuffer> chunk) { if (PlatformDependent.useDirectBufferNoCleaner()) { PlatformDependent.freeDirectNoCleaner(chunk.memory); } else { PlatformDependent.freeDirectBuffer(chunk.memory); } }
Example 4
Source File: ThreadLocalByteBufferPoolTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Test public void shouldNotPoolBufferOfDifferentType() { final int size = 32; final ByteBuffer buffer = isDirect ? ByteBuffer.allocate(size) : ByteBuffer.allocateDirect(size); try { pool.release(buffer); Assert.assertNotSame(buffer, pool.borrow(size, zeroed)); } catch (Throwable t) { if (PlatformDependent.hasUnsafe()) { if (buffer.isDirect()) { PlatformDependent.freeDirectBuffer(buffer); } } } }
Example 5
Source File: ODirectFileOutputStream.java From herddb with Apache License 2.0 | 5 votes |
@Override public void close() throws IOException { // this will add padding flush(true); fc.close(); PlatformDependent.freeDirectBuffer(originalBuffer); }
Example 6
Source File: MappedFile.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override public void close() { try { channel.close(); } catch (IOException e) { throw new IllegalStateException(e); } finally { //unmap in a deterministic way: do not rely on GC to do it PlatformDependent.freeDirectBuffer(this.buffer); } }
Example 7
Source File: PoolArena.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
@Override protected void destroyChunk(PoolChunk<ByteBuffer> chunk) { PlatformDependent.freeDirectBuffer(chunk.memory); }
Example 8
Source File: AmqpReadableBuffer.java From activemq-artemis with Apache License 2.0 | 4 votes |
public void freeDirectBuffer() { // releasing direct buffer created from mmap PlatformDependent.freeDirectBuffer(buffer); }
Example 9
Source File: NIOSequentialFileFactory.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override public void releaseDirectBuffer(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 10
Source File: UnsafeUtil.java From tajo with Apache License 2.0 | 4 votes |
public static void free(ByteBuffer bb) { PlatformDependent.freeDirectBuffer(bb); }
Example 11
Source File: MappedSequentialFileFactory.java From activemq-artemis with Apache License 2.0 | 4 votes |
@Override public void releaseDirectBuffer(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 12
Source File: UnpooledUnsafeDirectByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
/** * Free a direct {@link ByteBuffer} */ protected void freeDirect(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 13
Source File: AbstractSslEngineBenchmark.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
@Override void freeBuffer(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 14
Source File: UnpooledDirectByteBuf.java From netty4.0.27Learn with Apache License 2.0 | 4 votes |
/** * Free a direct {@link ByteBuffer} */ protected void freeDirect(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 15
Source File: OpenFileUtils.java From herddb with Apache License 2.0 | 4 votes |
public static void releaseAlignedBuffer(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 16
Source File: OpenFileUtils.java From herddb with Apache License 2.0 | 4 votes |
public static void releaseAlignedBuffer(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 17
Source File: XnioByteBufUtil.java From netty-xnio-transport with Apache License 2.0 | 4 votes |
static void freeDirect(ByteBuffer buffer, ByteBuffer newBuffer) { if (buffer != newBuffer) { PlatformDependent.freeDirectBuffer(buffer); } }
Example 18
Source File: UnpooledUnsafeDirectByteBuf.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
/** * Free a direct {@link ByteBuffer} */ protected void freeDirect(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 19
Source File: UnpooledDirectByteBuf.java From netty-4.1.22 with Apache License 2.0 | 4 votes |
/** * Free a direct {@link ByteBuffer} */ protected void freeDirect(ByteBuffer buffer) { PlatformDependent.freeDirectBuffer(buffer); }
Example 20
Source File: BufferPool.java From tajo with Apache License 2.0 | 2 votes |
/** * deallocate the specified direct memory * @param byteBuffer */ public static void free(ByteBuffer byteBuffer) { PlatformDependent.freeDirectBuffer(byteBuffer); }