vooley源码之ByteArrayPool

ByteArrayPool作为byte数组的来源和回收站,旨在提供短期使用的缓冲区,减少Android系统的堆内存碎片和垃圾收集延迟。当请求缓冲区时,如果回收池中没有合适大小的,会分配新缓冲区。该类确保缓冲池总大小不超过特定限制,超出时会释放最不常使用的缓冲区。
摘要由CSDN通过智能技术生成


ByteArrayPool 这个类是干嘛的


ByteArrayPool is a source and repository of <code>byte[]</code> objects. Its purpose is to supply those buffers to consumers who need to use them for a short period of time and then dispose of them. Simply creating and disposing such buffers in the conventional manner can considerable heap churn and garbage collection delays on Android, which lacks good management of short-lived heap objects. It may be advantageous to trade off some memory in the form of a permanently allocated pool of buffers in order to gain heap performance improvements; that is what this class does.

 * <p>

 * A good candidate user for this class is something like an I/O system that uses large temporary <code>byte[]</code> buffers to copy data around. In these use cases, often the consumer wants the buffer to be a certain minimum size to ensure good performance (e.g. when copying data chunks off of a

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值