Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,251
    • Issues 4,251
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 394
    • Merge Requests 394
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Wiki
    • Commentary
    • Rts
    • Storage
    • Gc
  • roots

Last edited by Takenobu Tani Apr 20, 2019
Page history New page

roots

Garbage Collection Roots

The "roots" are the set of pointers that the GC starts traversing from, i.e. the roots of the live object graph.

Most roots belong to a particular Capability. Traversing the roots of a capbility is done by markSomeCapabilities() in rts/Capability.c. The roots of a Capability are:

  • The run queue (head and tail)
  • The wakeup queue (head and tail)
  • For each Task on the suspended_ccalling_tasks list, the TSO for that Task
  • The Spark Pool
  • Only for the non-threaded RTS: The blocked queue (head and tail), and the sleeping queue

In addition, each Capability has a remembered set for each generation. A remembered set is a source of roots if that generation is not being collected during this cycle; otherwise the remembered set is discarded. During GC, all remembered sets are discarded and new ones will be constructed for each generation and Capability; see scavenge_capability_mut_lists() in rts/sm/Scav.c.

There are also roots from other parts of the system:

  • Signal handlers (only in the non-threaded RTS; in the threaded RTS signal handlers are maintained by the IO manager in GHC.Conc rather than the RTS).
  • Weak pointers
  • Stable pointers?
Clone repository

GHC Home
GHC User's Guide

Joining In

Newcomers info
Mailing Lists & IRC
The GHC Team

Documentation

GHC Status Info
Working conventions
Building Guide
Debugging
Commentary

Wiki

Title Index
Recent Changes