wenbingshen commented on PR #3913:
URL: https://github.com/apache/bookkeeper/pull/3913#issuecomment-1506868164

   > I have a question about this. The memory occupation is not about the array 
size. The key(CompletionKey) and the value(CompletionValue) is the occupier. As 
long as the key and the value is removed, the memory occupation will be 
decrease. We make the array size autoShrink didn't help the GC
   
   @horizonzy The layout of the array object in memory, when pointer 
compression is enabled, includes
   array object header + length * 4 (reference) + length * (single element size)
   
   We have an object array with a size of 16384, and the space it occupies in 
memory is = 8 + 4 + 4 + 4 * 16384 = 65552
   In our pulsar broker, such an array would occupy about = 65552 * 16 * 1776 = 
1.74GB
   
   If we can turn on autoShrink, in the case of size=0, the array size will 
shrink to 24. 
   And the space it occupies in memory is = 8 + 4 + 4 + 4 * 24 = 112
   In our pulsar broker, such an array would occupy about = 112 * 16 * 1776 = 
3108KB
   
   This way we can reclaim a lot of space in memory.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to