Skip to content

Netty still uses heap buffers while preferDirect is true #9345

@doom369

Description

@doom369

Before https://github.com/netty/netty/pull/9167/files I thought that heap buffers within our app is normal. Now, it seems to be another issue.
With 4.1.37.Final I still see heap buffers usage. In logs I found this instances:

DefaultFullHttpResponse(decodeResult: success, version: HTTP/1.1, content: UnpooledByteBufAllocator$InstrumentedUnpooledUnsafeHeapByteBuf(ridx: 0, widx: 0, cap: 0))

Look like this is due to DefaultFullHttpResponse that uses inside Unpooled.buffer(0). Search shows Unpooled.buffer(0) usage in 20 different places within current netty codebase (mostly in http and websockets package).

My question - is that expected? Shouldn't DefaultFullHttpResponse use Unpooled.EMPTY_BUFFER instead of Unpooled.buffer(0)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions