Skip to content

Conversation

@gaozhangmin
Copy link
Contributor

Previously, the memory allocation strategy was limited to pooled memory on the Java heap.
This update adds support for unpooled memory allocation off-heap, allowing greater flexibility in memory management and reducing GC pressure in certain workloads.

@Override
public ByteBuf buffer(int initialCapacity, int maxCapacity) {
if (poolingPolicy == PoolingPolicy.PooledDirect) {
if (poolingPolicy == PoolingPolicy.PooledDirect || poolingPolicy == PoolingPolicy.UnpooledDirect) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PooledDirect and UnpooledDirect have the same implementation logic, so what's the point of adding this enumeration? I don't quite understand the purpose of your change.

Also, for the new types, I suggest adding testcase coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

poolingPolicy == PoolingPolicy.PooledDirect condition in newDirectBuffer

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unpooled did the same thing here

poolingPolicy == PoolingPolicy.PooledDirect condition in newDirectBuffer

@lhotari
Copy link
Member

lhotari commented Aug 12, 2025

This update adds support for unpooled memory allocation off-heap, allowing greater flexibility in memory management and reducing GC pressure in certain workloads.

how does this reduce GC pressure in certain workloads?

@Override
public ByteBuf buffer(int initialCapacity, int maxCapacity) {
if (poolingPolicy == PoolingPolicy.PooledDirect) {
if (poolingPolicy == PoolingPolicy.PooledDirect || poolingPolicy == PoolingPolicy.UnpooledDirect) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unpooled did the same thing here

poolingPolicy == PoolingPolicy.PooledDirect condition in newDirectBuffer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants