index.rst (2711B)
1 ================ 2 Basic operations 3 ================ 4 5 6 .. _memory-basic-operations-taking-a-heap-snapshot: 7 8 Taking a heap snapshot 9 ********************** 10 11 To take a snapshot of the heap, click the "Take snapshot" button, or the camera icon on the left: 12 13 .. image:: memory-1-small.png 14 :class: center 15 16 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: 17 18 .. image:: memory-2-small.png 19 :class: center 20 21 22 .. _memory-basic-operations-clearing-a-snapshot: 23 24 Clearing a snapshot 25 ******************* 26 27 To remove a snapshot, click the "X" icon: 28 29 .. image:: memory-3-small.png 30 :class: center 31 32 33 .. _memory-basic-operations-saving-and-loading-snapshots: 34 35 Saving and loading snapshots 36 **************************** 37 38 If you close the Memory tool, all unsaved snapshots will be discarded. To save a snapshot click "Save": 39 40 .. image:: memory-4-small.png 41 :class: center 42 43 You'll be prompted for a name and location, and the file will be saved with an ``.fxsnapshot`` extension. 44 45 To load a snapshot from an existing ``.fxsnapshot`` file, click the import button, which looks like a rectangle with an arrow rising from it: 46 47 .. image:: memory-5-small.png 48 :class: center 49 50 You'll be prompted to find a snapshot file on disk. 51 52 53 .. _memory-basic-operations-comparing-snapshots: 54 55 Comparing snapshots 56 ******************* 57 58 You can diff two heap snapshots. The diff shows you where memory was allocated or freed between the two snapshots. 59 60 To create a diff, click the button that looks like a Venn diagram next to the camera icon: 61 62 .. image:: memory-6-small.png 63 :class: center 64 65 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: 66 67 .. raw:: html 68 69 <iframe width="560" height="315" src="https://www.youtube.com/embed/3Ow-mdK6b2M" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> 70 <br/> 71 <br/> 72 73 .. note:: 74 When you're looking at a comparison, you can't use the Dominators view or the Tree Map view. 75 76 77 .. _memory-basic-operations-recording-call-stacks: 78 79 Recording call stacks 80 ********************* 81 82 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": 83 84 .. image:: memory-7-small.png 85 :class: center