Dgram memory detection patch

This contains a few patches to make heap inspection for memory leaks easier.

cc @tomuber @sh1mmer @mranney