Skip to content

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 (closed).

Merge request reports