summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorFabian Thorand <fabian@channable.com>2020-10-14 14:04:24 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-29 09:40:51 -0400
commitbe77a9e07d9f77af48fd9defd92de85560d884c0 (patch)
tree5b9d6cfd4fa4e2113fded30136314306b1f68f98 /rts
parentb8d98827d73fd3e49867cab09f9440fc8c311bfe (diff)
downloadhaskell-be77a9e07d9f77af48fd9defd92de85560d884c0.tar.gz
Remove special case for large objects in allocateForCompact
allocateForCompact() is called when the current allocation for the compact region does not fit in the nursery. It previously had a special case for objects exceeding the large object threshold. In that case, it would allocate a new compact region block just for that object. That led to a lot of small blocks being allocated in compact regions with a larger default block size (`autoBlockW`). This commit removes this special case because having a lot of small compact region blocks contributes significantly to memory fragmentation. The removal should be valid because - a more generic case for allocating a new compact region block follows at the end of allocateForCompact(), and that one takes `autoBlockW` into account - the reason for allocating separate blocks for large objects in the main heap seems to be to avoid copying during GCs, but once inside the compact region, the object will never be copied anyway. Fixes #18757. A regression test T18757 was added.
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/CNF.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/rts/sm/CNF.c b/rts/sm/CNF.c
index 25c50adcc3..a6bd3b69f0 100644
--- a/rts/sm/CNF.c
+++ b/rts/sm/CNF.c
@@ -489,17 +489,6 @@ allocateForCompact (Capability *cap,
bd = Bdescr((P_)str->nursery);
bd->free = str->hp;
- // We know it doesn't fit in the nursery
- // if it is a large object, allocate a new block
- if (sizeW > LARGE_OBJECT_THRESHOLD/sizeof(W_)) {
- next_size = BLOCK_ROUND_UP(sizeW*sizeof(W_) + sizeof(StgCompactNFDataBlock));
- block = compactAppendBlock(cap, str, next_size);
- bd = Bdescr((P_)block);
- to = bd->free;
- bd->free += sizeW;
- return to;
- }
-
// move the nursery past full blocks
if (block_is_full (str->nursery)) {
do {