Basic operationsď
Taking a heap snapshotď
To take a snapshot of the heap, click the âTake snapshotâ button, or the camera icon on the left:
The snapshot will occupy the large pane on the right-hand side. On the left, youâll see an entry for the new snapshot, including its timestamp, size, and controls to save or clear this snapshot:
Clearing a snapshotď
To remove a snapshot, click the âXâ icon:
Saving and loading snapshotsď
If you close the Memory tool, all unsaved snapshots will be discarded. To save a snapshot click âSaveâ:
Youâll be prompted for a name and location, and the file will be saved with an .fxsnapshot extension.
To load a snapshot from an existing .fxsnapshot file, click the import button, which looks like a rectangle with an arrow rising from it:
Youâll be prompted to find a snapshot file on disk.
Comparing snapshotsď
You can diff two heap snapshots. The diff shows you where memory was allocated or freed between the two snapshots.
To create a diff, click the button that looks like a Venn diagram next to the camera icon:
Youâll be prompted to select the snapshot to use as a baseline, then the snapshot to compare. The tool then shows you the differences between the two snapshots:
Note
When youâre looking at a comparison, you canât use the Dominators view or the Tree Map view.
Recording call stacksď
The Memory tool can tell you exactly where in your code you are allocating memory. However, recording this information has a run-time cost, so you must ask the tool to record memory calls before the memory is allocated, if you want to see memory call sites in the snapshot. To do this, check âRecord call stacksâ: