Avoid accumulating slop in the pinned_object_block.
authorSimon Marlow <marlowsd@gmail.com>
Thu, 14 Apr 2011 07:59:39 +0000 (08:59 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 14 Apr 2011 08:01:52 +0000 (09:01 +0100)
commitcc2ea98ac4a15e40a15e89de9e47f33e191ba393
treef3ed770c0908c21b13d9f86afb326d5e01e3d28c
parent25297a13bd6be722a74ee87237498a5626b298ef
Avoid accumulating slop in the pinned_object_block.

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.
rts/Stats.c
rts/sm/GC.c
rts/sm/Sanity.c
rts/sm/Storage.c