Skip to content
GitLab
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 5,357
    • Issues 5,357
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 566
    • Merge requests 566
  • 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 CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !6202

Stop ug_boring_info retaining a chain of old CoreExpr (and fix a few other retainer leaks)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Matthew Pickering requested to merge wip/t20134 into master Jul 21, 2021
  • Overview 35
  • Commits 2
  • Pipelines 2
  • Changes 4

It was noticed in #20134 that each simplifier iteration used an increasing amount of memory and that a certain portion of memory was not released until the simplfier had completely finished.

I profiled the program using -hi profiling and observed that there was a thunk arising in the computation of ug_boring_ok. On each iteration ug_boring_ok would be updated, but not forced, which would leave a thunk in the shape of

ug_boring_ok = inlineBoringOk expr0 || inlineBoringOk expr2 || inlineBoringOk expr3 || ...

which would retain all previous expr until ug_boring_ok was forced or discarded.

Forcing this accumulator eagerly results in a flat profile over multiple simplifier runs.

This reduces the maximum residency when compiling the test in #20134 from 2GB to 1.3G.

Before: 2021-07-21-093445_1151x988

After: 2021-07-21-093451_1214x1000

cc @simonpj

Edited Jul 21, 2021 by Matthew Pickering
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: wip/t20134