Created
May 27, 2021 18:00
-
-
Save samth/ff84e45a64cc84ff68c461d6d1837e4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require sugar) | |
(define (go file h) | |
(define lines (file->lines file)) | |
(match-define (list header chunks ... summary) (filter-split lines (lambda (l) (equal? l "")))) | |
(define p | |
(for/list ([l chunks]) | |
(define size (regexp-match "leak of (.+) .* in (.+) object" (car l))) | |
(list (and size (map string->number (cdr size))) | |
(filter values | |
(for/list ([i (cdr l)]) | |
(define fn (regexp-match #rx" in (.+) \\(" i)) | |
(and fn (second fn))))))) | |
(for/fold ([h h]) ([i p]) | |
(hash-update h (second i) (match-lambda [(list b n) (list (+ (first (car i)) b) | |
(+ (second (car i)) n))]) | |
(list 0 0)))) | |
(define h | |
(for/fold ([h (hash)]) | |
([i (find-files (lambda (v) (regexp-match "^racket-asan" v)))]) | |
(go i h))) | |
(sort (hash-map h list) > | |
#:key (compose car second)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment