Pooled ByteBuf和UnPooled ByteBuf有什么区别

时间:2013-10-01 12:18:13

标签: netty

package io.netty.buffer下,存在多种类型的ByteBuf,例如PooledDirectByteBufPooledHeapByteBufUnpooledDirectByteBufUnpooledHeapByteBuf。有人可以解释他们的不同吗?

1 个答案:

答案 0 :(得分:5)

汇集的ByteBuf就是他们的名字所说的......它们被汇集在一起​​意味着它们不是直接发布而是汇集在一起​​以便它们可以再次被重用。这主要是有用的,因为直接ByteBuf的分配和取消分配是昂贵的。