Skip to content
  • Teo Camarasu's avatar
    rts: use live words to estimate heap size · 66919dcc
    Teo Camarasu authored and Marge Bot's avatar Marge Bot committed
    We use live words rather than live blocks to determine the size of the
    heap for determining memory retention.
    
    Most of the time these two metrics align, but they can come apart in
    normal usage when using the nonmoving collector.
    
    The nonmoving collector leads to a lot of partially occupied blocks. So,
    using live words is more accurate.
    
    They can also come apart when the heap is suffering from high levels
    fragmentation caused by small pinned objects, but in this case, the
    block size is the more accurate metric. Since this case is best avoided
    anyway. It is ok to accept the trade-off that we might try (and
    probably) fail to return more memory in this case.
    
    See also the Note [Statistics for retaining memory]
    
    Resolves #23397
    66919dcc