io_uring: 回收提供的缓冲区环的缓冲区,而不是重新分配它们
作者: franz1981创建于 2026年9月26日更新于 2026年9月26日
`IoUringFixedBufferRingAllocator` 和 `IoUringAdaptiveBufferRingAllocator` 都会在 `AbstractIoUringBufferRingAllocator.allocate()` 中调用 `allocator.directBuffer(nextBufferSize())`: 核心所消耗的每个缓冲区都会被一个通用 `ByteBufAllocator` 生成的新的 `ByteBuf` 替换,尽管环境中仍然保留了 `bufferRingSize` 个缓冲区 - 只有对象和其内存被重新创建。其他 io_uring 使用者为每个环提供一个连续区域,并通过 ID 回收缓冲区:
内容来源: netty/netty