janestreet / memtrace

Streaming client for OCaml's Memprof
MIT License
65 stars 13 forks source link

Fix bug when consecutive truncated stacks share a long prefix #15

Closed stedolan closed 2 years ago

stedolan commented 2 years ago

Memtrace notices when two consecutive backtraces share a long prefix and doesn't encode the prefix twice. However, since very long backtraces are truncated, it is possible in some cases to have a shared prefix that is longer than the untruncated portion. This triggered an assertion failure in the reader, fixed by this patch.

(This is a reader-only fix, so should make traces that hit this bug become readable without changes)