issue-557: added support for dumping heap profile via signal

This applies patch from Jean Lee.

I've reformatted it to match surronding code style and changed
validation logic a bit. I.e. we're not checking signal for range
anymore given we're not sure what different platforms support, but
we're checking return value of signal() for SIG_ERR instead.