Add memory dump capability to leak detector

Rather than printf the contents of arbitrary memory into the leak
detection report (which breaks UT on various compilers/platforms/
optimization levels, and probably JUnit output), print out a
hexdump-like view of the memory, with printable ASCII where
possible.