triump2020 commented on issue #1136:
URL: https://github.com/apache/incubator-brpc/issues/1136#issuecomment-651534879


   > > @kof02guy 从 ObjectPool 中分配的对象所占用的内存是不会归还给系统的,如果到达最大值,再从里面分配,会返回null.
   > > 这个最大值从代码看目前不能调整, 是const 常量.
   > > ObjectPool 适用于分配比较固定大小的 
,且生命周期比较短暂的,分配完之后,可能过一会儿就归还给Pool的object。这样ObjectPool 保持一个动态平衡。在这样的场景下, 性能应该很高.
   > 
   > 
有的场景下,可能系统存在一个很高的性能尖峰,在那个尖峰可能需要分配很多的资源。但是在大多数情况下,系统的压力都很低,那些在性能尖峰分配出来的资源如果不shrink的话,那么相当于是变相的资源浪费了
   
   你说的场景下是这样的,确实会占用内存。  ObjectPool 当初这么设计可能就是追求性能,分配和释放都是O(1).   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to