OpenSsl.memoryAddress(...) should use internalNioBuffer(...) if it can't access the memoryAddress (#10818)
Motivation: We can make use of internalNioBuffer(...) if we cant access the memoryAddress. This at least will reduce the object creations. Modifications: Use internalNioBuffer(...) and so reduce the GC Result: Less object creation if we can't access the memory address.
This commit is contained in:
parent
7d53b97c0f
commit
6c446d14fd
@ -525,7 +525,9 @@ public final class OpenSsl {
|
|||||||
|
|
||||||
static long memoryAddress(ByteBuf buf) {
|
static long memoryAddress(ByteBuf buf) {
|
||||||
assert buf.isDirect();
|
assert buf.isDirect();
|
||||||
return buf.hasMemoryAddress() ? buf.memoryAddress() : Buffer.address(buf.nioBuffer());
|
return buf.hasMemoryAddress() ? buf.memoryAddress() :
|
||||||
|
// Use internalNioBuffer to reduce object creation.
|
||||||
|
Buffer.address(buf.internalNioBuffer(0, buf.readableBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private OpenSsl() { }
|
private OpenSsl() { }
|
||||||
|
Loading…
Reference in New Issue
Block a user