Skip to content

Account for large/compact objects living on the non-moving heap

Teo Camarasu requested to merge teo/ghc:wip/T17574 into master

This MR aims to account for live large/compact objects living on the non-moving heap for live bytes stats.

We do this by introducing some variables to track live large/compact words on the nonmoving heap and by updating the calculation code to take them into account. I've also added a test case to catch regressions in the future.

This should resolve #17574 (closed) .

With the changes in this branch the code from the ticket gives the following output:

`./Pusher +RTS -s` (moving gc)
  18,541,957,480 bytes allocated in the heap
     680,834,408 bytes copied during GC
     576,054,248 bytes maximum residency (12 sample(s))
     162,787,160 bytes maximum slop
            1492 MiB total memory in use (0 MiB lost due to fragmentation)

                                     Tot time (elapsed)  Avg pause  Max pause
  Gen  0      4579 colls,     0 par    0.902s   1.091s     0.0002s    0.0023s
  Gen  1        12 colls,     0 par    0.393s   0.393s     0.0328s    0.0882s

  TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)

  SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.001s  (  0.001s elapsed)
  MUT     time    7.801s  (  7.578s elapsed)
  GC      time    1.295s  (  1.484s elapsed)
  EXIT    time    0.001s  (  0.001s elapsed)
  Total   time    9.098s  (  9.064s elapsed)

  Alloc rate    2,376,824,551 bytes per MUT second

  Productivity  85.7% of total user, 83.6% of total elapsed
`./Pusher +RTS -xn -s` (nonmoving gc)
  18,541,955,736 bytes allocated in the heap
     617,671,720 bytes copied during GC
   1,481,940,976 bytes maximum residency (13 sample(s))
     343,236,624 bytes maximum slop
            1800 MiB total memory in use (0 MiB lost due to fragmentation)

                                     Tot time (elapsed)  Avg pause  Max pause
  Gen  0      4578 colls,     0 par    1.802s   1.825s     0.0004s    0.0045s
  Gen  1        13 colls,     0 par    0.036s   0.036s     0.0028s    0.0094s
  Gen  1        13 syncs,                       0.013s     0.0010s    0.0040s
  Gen  1      concurrent,              0.467s   0.500s     0.0384s    0.1288s

  TASKS: 16 (13 bound, 3 peak workers (3 total), using -N1)

  SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.001s  (  0.001s elapsed)
  MUT     time    7.565s  (  7.524s elapsed)
  GC      time    1.838s  (  1.861s elapsed)
  CONC GC time    0.467s  (  0.500s elapsed)
  EXIT    time    0.000s  (  0.001s elapsed)
  Total   time    9.872s  (  9.387s elapsed)

  Alloc rate    2,450,986,269 bytes per MUT second

  Productivity  81.4% of total user, 80.2% of total elapsed

cc @bgamari

Merge request reports