tsan: allow to write memory profile to stdout/stderr