#9345 use default allocator when possible to avoid heap allocations#9359
Conversation
|
Can one of the admins verify this patch? |
|
@netty-bot test this please |
1 similar comment
|
@netty-bot test this please |
codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java
Outdated
Show resolved
Hide resolved
|
@netty-bot test this please |
|
@doom369 there is a leak... please fix :) |
|
@normanmaurer lol, this leaks mostly are due to wrong implementation / tests :). Default allocator just exposes these places. Fixing... |
|
@doom369 I agree ;) |
|
@netty-bot test this please |
|
@netty-bot test this please |
|
@normanmaurer this PR becomes more and more complex with further test fixes :). Found at least 1 place that should be fixed before the further processing. HttpPostMultipartRequestDecoder: This copy operation inside causes memory leak with direct buffers and look like not released in all flows. |
…ns in WebSockets
|
Closing this one as it is very generic. Will provide separate PR for separate package. |
Motivation:
In many places Netty uses
Unpooled.buffer(0)while should useEMPTY_BUFFER. We can't change this due to back compatibility, however we can at least replaceUnpooled.buffer(0)withByteBufAllocator.DEFAULT.buffer(0)so in evns. withpreferDirect=trueheap will not be used.This change affects mostly http and websockets users.
Modification:
Unpooled.buffer(0)withByteBufAllocator.DEFAULT.buffer(0);Unpooled.copiedBuffer(text, CharsetUtil.UTF_8)withByteBufUtil.encodeString(ByteBufAllocator.DEFAULT, CharBuffer.wrap(text), CharsetUtil.UTF_8);Result:
Fixes #9345