Skip to content

RTS allocation sites do not try GCing before failing

While working on the IO manager, @duncan and I noticed that various large allocation sites within primops may fail spuriously when +RTS -M... is used. Specifically, these primops call allocateMayFail and on failure immediately throw an exception. However, it is possible that the allocation would have succeeded if we first attempted to GC.

The following primops exhibit this pathology:

  • stg_newPinnedByteArrayzh
  • stg_newByteArrayzh
  • stg_newAlignedPinnedByteArrayzh
  • stg_newArrayzh
  • stg_newSmallArrayzh
  • stg_unpackClosurezh
Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information