Class CleanerJava24Linker
java.lang.Object
io.netty.util.internal.CleanerJava24Linker
Allocates direct buffers with malloc and free from libc, linked through the Foreign Function & Memory API.
The FFM API is compiled against the netty-ffm-stub module. It and the signature-polymorphic
MethodHandle calls are only used from the nested classes, which are only loaded on Java versions that
have the FFM API, so this class still loads and verifies where it is missing (e.g. Android).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocate(int capacity) voidfreeDirectBuffer(ByteBuffer buffer) booleandefault CleanableDirectBufferreallocate(CleanableDirectBuffer old, int newCapacity) Reallocate a direct buffer with a new capacity.
-
Constructor Details
-
CleanerJava24Linker
public CleanerJava24Linker()
-
-
Method Details
-
allocate
-
freeDirectBuffer
-
hasExpensiveClean
public boolean hasExpensiveClean() -
reallocate
Reallocate a direct buffer with a new capacity. The old buffer is consumed and must not be used after this call.The default implementation allocates a new buffer, copies the data, and frees the old one. Implementations may override this to provide more efficient reallocation (e.g. via
Unsafe.reallocateMemory).
-