Skip to content
  • Simon Marlow's avatar
    Avoid accumulating slop in the pinned_object_block. · cc2ea98a
    Simon Marlow authored
    The pinned_object_block is where we allocate small pinned ByteArray#
    objects.  At a GC the pinned_object_block was being treated like other
    large objects and promoted to the next step/generation, even if it was
    only partly full.  Under some ByteString-heavy workloads this would
    accumulate on average 2k of slop per GC, and this memory is never
    released until the ByteArray# objects in the block are freed.
    
    So now, we keep allocating into the pinned_object_block until it is
    completely full, at which point it is handed over to the GC as before.
    The pinned_object_block might therefore contain objects which a large
    range of ages, but I don't think this is any worse than the situation
    before.  We still have the fragmentation issue in general, but the new
    scheme can improve the memory overhead for some workloads
    dramatically.
    cc2ea98a