Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,869
    • Issues 4,869
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20431
Closed
Open
Created Sep 28, 2021 by Ben Gamari@bgamari🐢Maintainer

Compiler allocations are sensitive to environment variables

It turns out that GHC's allocations are quite sensitive to environment variables:

$ HI="$(yes | head -n 10000)" ghc -Rghc-timing
ghc: no input files
Usage: For basic information, try the `--help' option.
<<ghc: 17523568 bytes, 17 GCs, 1243182/2375192 avg/max bytes residency (4 samples), 6M in use, 0.001 INIT (0.001 elapsed), 0.010 MUT (0.010 elapsed), 0.053 GC (0.054 elapsed) :ghc>>

$ HI="" ghc -Rghc-timing
ghc: no input files
Usage: For basic information, try the `--help' option.
<<ghc: 16368120 bytes, 16 GCs, 908760/1347632 avg/max bytes residency (3 samples), 5M in use, 0.001 INIT (0.000 elapsed), 0.009 MUT (0.009 elapsed), 0.036 GC (0.037 elapsed) :ghc>>

I suspect that the reason is the use of System.Environment.getEnvironment (which decodes all environment variables into Haskell Strings) in GHC.HandleEncoding.configureHandleEncoding. This could easily be changed to rather use getEnv, which is far more surgical.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking