Cherry-pick of XDK HeapProfiler bug fixes

It is a cherry pick of fix #65
There are a lot of changes due to fixing of line endings, reviewed in #67