Skip to content

Instantly share code, notes, and snippets.

Created May 27, 2021 18:00
What would you like to do?
#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