[Profile] Add Heap Snapshot tool (#46862)
We expose a function `Profile.take_heap_snapshot(file)`, which writes a
heap snapshot in Chrome's .heapsnapshot JSON format to the given IO
stream.
This can be loaded into Chrome Devtools' snapshot viewer to explore the
heap and find memory leaks.
Co-Authored-By: Dean De Leo <dean.deleo@relational.ai>
Co-Authored-By: Nathan Daly <NHDaly@gmail.com>
Co-Authored-By: Pete Vilter <7341+vilterp@users.noreply.github.com>
Co-Authored-By: Valentin Churavy <v.churavy@gmail.com>
Co-Authored-By: Jameson Nash <vtjnash@gmail.com>