For the peak memory usage, I think people usually use OCAMLRUNPARAM='v=0x400' ./my_program
. It’s likely more reliable than memtrace, which has to rely on statistical estimations.
I can’t help you with memtrace building instructions, but we (at OCamlPro) developed an alternative viewer for the dumps generated by memtrace called memthol (see announce here). It’s coded in Rust, so not necessarily easier to patch, but I think it already has the scale for the memory graphs.