Skip to content

Big types and memory consumption when profiling

Summary

I have an application with a large data type (more than a hundred records).

If I enable profiling, GHC 8.8.2 takes a huge amount of memory and time to compile the module containing the sole aeson instances. Generic shouldn't be the culprit since the instances are non-empty.

After 1 hour and 60G of memory consumed, I can't tell the total amount of memory required, because I'm forced to end the process for lack of space for the swap file.

Steps to reproduce

Create a datatype with a hundred records (mostly Text and Int, strict and packed) and both the instances FromJson and ToJson.

Build with stack build --profile.

Environment

GHC 8.8.2 and stack.

Optional:

  • Operating System: MacOs Catalina 10.15.4
  • System Architecture:
Edited by Nicola Bonelli
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information