Skip to content

Draft: Progress MR for BLeak Analysis

I am creating this MR for the purposes of sharing my progress so far. I will clean up all my commits after, I just wanted a convenient way to share.

The main idea is, I am tracking the largest depths / number of other thunks reachable from one thunk, and the change in these metrics over time. If you squint enough, the idea is somewhat similar to BLeak. By using depth/number of reachable nodes, we can "quotient out" the closure ptr addresses and not have to worry about GC re-arranging.

I made a very contrived LazyThunk.hs program where I lazily modify a MVar with (+1), which results in a linked list of thunks, which each (+1) pointing to the next (+1), which I confirmed with ghc-debug (I think)!

Example output of my Bleak analysis on LazyThunk.hs

Printing adjacency list...

0x10d2c8e38: []
0x10d40b468: []
0x42005cc528: [0x10d2c8e38]
0x42005cc588: [0x42005cc5e0]
0x42005cc5e0: [0x42005cc610]
0x42005cc610: [0x10d40b468]
Printing max depths...

0x10d2c8e38:  Depth 1 Reachable [0x10d2c8e38]
0x10d40b468:  Depth 1 Reachable [0x10d40b468]
0x42005cc528:  Depth 2 Reachable [0x42005cc528,0x10d2c8e38]
0x42005cc588:  Depth 4 Reachable [0x42005cc588,0x42005cc5e0,0x42005cc610,0x10d40b468]
0x42005cc5e0:  Depth 3 Reachable [0x42005cc5e0,0x42005cc610,0x10d40b468]
0x42005cc610:  Depth 2 Reachable [0x42005cc610,0x10d40b468]
Hit Enter to take second analysis...


Printing adjacency list...

0x10d2c8dd8: []
0x10d2c8e38: []
0x10d40b468: []
0x42005cd130: [0x10d2c8dd8]
0x42005cd358: [0x42005cd3c0]
0x42005cd3c0: [0x42005cd3d8]
0x42005cd3d8: [0x42005cf478]
0x42005cf478: [0x42005cf4a0]
0x42005cf4a0: [0x42005cf4b8]
0x42005cf4b8: [0x10d40b468]
0x42005d2b18: [0x10d2c8e38]
Printing max depths...

0x10d2c8dd8:  Depth 1 Reachable [0x10d2c8dd8]
0x10d2c8e38:  Depth 1 Reachable [0x10d2c8e38]
0x10d40b468:  Depth 1 Reachable [0x10d40b468]
0x42005cd130:  Depth 2 Reachable [0x42005cd130,0x10d2c8dd8]
0x42005cd358:  Depth 7 Reachable [0x42005cd358,0x42005cd3c0,0x42005cd3d8,0x42005cf478,0x42005cf4a0,0x42005cf4b8,0x10d40b468]
0x42005cd3c0:  Depth 6 Reachable [0x42005cd3c0,0x42005cd3d8,0x42005cf478,0x42005cf4a0,0x42005cf4b8,0x10d40b468]
0x42005cd3d8:  Depth 5 Reachable [0x42005cd3d8,0x42005cf478,0x42005cf4a0,0x42005cf4b8,0x10d40b468]
0x42005cf478:  Depth 4 Reachable [0x42005cf478,0x42005cf4a0,0x42005cf4b8,0x10d40b468]
0x42005cf4a0:  Depth 3 Reachable [0x42005cf4a0,0x42005cf4b8,0x10d40b468]
0x42005cf4b8:  Depth 2 Reachable [0x42005cf4b8,0x10d40b468]
0x42005d2b18:  Depth 2 Reachable [0x42005d2b18,0x10d2c8e38]

Merge request reports