Skip to content
  • Simon Marlow's avatar
    Allocate blocks in the GC in batches · f4446c5b
    Simon Marlow authored
    Avoids contention for the block allocator lock in the GC; this can be
    seen in the gc_alloc_block_sync counter emitted by +RTS -s.
    
    I experimented with this a while ago, and there was already
    commented-out code for it in GCUtils.c, but I've now improved it so that
    it doesn't result in significantly worse memory usage.
    
    * The old method of putting spare blocks on ws->part_list was wasteful,
      the spare blocks are now shared between all generations and retained
      between GCs.
    
    * repeated allocGroup() results in fragmentation, so I switched to using
      allocLargeChunk() instead which is fragmentation-friendly; we already
      use it for the same reason in nursery allocation.
    f4446c5b