You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/debugger/memory-windows.md
+25-13Lines changed: 25 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: View memory for variables in the debugger
3
3
description: Learn how to use Memory windows as you debug, to see the memory space your app is using. Other windows show variables and where they reside in memory.
4
-
ms.date: 11/30/2023
4
+
ms.date: 11/19/2024
5
5
ms.topic: how-to
6
6
f1_keywords:
7
7
- vs.debug.memory
@@ -40,51 +40,63 @@ Like other debugger windows, the **Memory** windows are available only during a
40
40
>[!IMPORTANT]
41
41
>To enable the **Memory** windows, **Enable address-level debugging** must be selected in **Tools** > **Options** (or **Debug** > **Options**) > **Debugging** > **General**.
42
42
43
-
**To open a Memory window**
43
+
Open a Memory window:
44
44
45
45
1. Make sure **Enable address-level debugging** is selected in **Tools** > **Options** (or **Debug** > **Options**) > **Debugging** > **General**.
46
46
47
47
1. Start debugging by selecting the green arrow, pressing **F5**, or selecting **Debug** > **Start Debugging**.
48
48
49
49
2. Under **Debug** > **Windows** > **Memory**, select **Memory 1**, **Memory 2**, **Memory 3**, or **Memory 4**. (Some editions of Visual Studio offer only one **Memory** window.)
50
50
51
+
Multiple windows allow you to maintain views for different areas in memory space at the same time.
52
+
51
53
## Move around in the Memory window
52
54
53
55
The address space of a computer is large, and you can easily lose your place by scrolling in the **Memory** window.
54
56
55
57
Higher memory addresses appear at the bottom of the window. To view a higher address, scroll down. To view a lower address, scroll up.
56
58
59
+
In most scenarios, you want to find a specific memory location.
60
+
61
+
## Find a memory location
62
+
57
63
You can instantly go to a specified address in the **Memory** window by using drag-and-drop, or by entering the address in the **Address** field. The **Address** field accepts alphanumeric addresses, and expressions that evaluate to addresses, such as `e.User.NonroamableId`.
58
64
59
65
To force immediate re-evaluation of an expression in the **Address** field, select the rounded-arrow **Reevaluate Automatically** icon.
60
66
61
67
By default, the **Memory** window treats **Address** expressions as live expressions, which are re-evaluated as the app runs. Live expressions can be useful, for example, to view the memory that is touched by a pointer variable.
62
68
63
-
**To use drag and drop to move to a memory location:**
69
+
Use drag and drop to move to a memory location:
64
70
65
71
1. In any debugger window, select a memory address, or a pointer variable that contains a memory address.
66
72
67
-
2. Drag and drop the address or pointer in the **Memory** window. That address then appears in the **Address** field, and the **Memory** window adjusts to display that address at the top.
73
+
1. Drag and drop the address or pointer in the **Memory** window.
74
+
75
+
That address appears in the **Address** field, and the **Memory** window adjusts to display that address at the top.
76
+
77
+
Entering a location in the Address field to move to a memory location:
78
+
79
+
- Type or paste the address or expression in the **Address** field and press **Enter**, or choose it from the dropdown in the **Address** field.
68
80
69
-
**To move to a memory location by entering it in the Address field:**
81
+
That address appears in the **Address** field, and the **Memory** window adjusts to display that address at the top.
70
82
71
-
- Type or paste the address or expression in the **Address** field and press **Enter**, or choose it from the dropdown in the **Address** field. The **Memory** window adjusts to display that address at the top.
83
+

72
84
73
85
## Customize the Memory window
74
86
75
87
By default, memory contents appear as 1-byte integers in hexadecimal format, and the window width determines the number of columns shown. You can customize the way the **Memory** window shows memory contents.
76
88
77
-
**To change the format of the memory contents:**
89
+
Change the format of the memory contents:
78
90
79
91
- Right-click in the **Memory** window, and choose the formats that you want from the context menu.
80
92
81
-
**To change the number of columns in the Memory window:**
93
+
Change the number of columns in the Memory window:
82
94
83
-
- Select the drop down arrow next to the **Columns** field, and select the number of columns to display, or select **Auto** for automatic adjustment based on window width.
95
+
- Select the dropdown arrow next to the **Columns** field, and select the number of columns to display, or select **Auto** for automatic adjustment based on window width.
84
96
85
97
If you do not want the contents of the **Memory** window to change as your app runs, you can turn off live expression evaluation.
86
98
87
-
**To toggle live evaluation:**
99
+
Toggle live evaluation:
88
100
89
101
- Right-click in the **Memory** window, and select **Reevaluate Automatically** in the context menu.
90
102
@@ -93,15 +105,15 @@ If you do not want the contents of the **Memory** window to change as your app r
93
105
94
106
You can hide or display the toolbar at the top of the **Memory** window. You will not have access to the **Address** field or other tools when the toolbar is hidden.
95
107
96
-
**To toggle the toolbar display:**
108
+
Toggle the toolbar display:
97
109
98
110
- Right-click in the **Memory** window, and select **Show Toolbar** in the context menu. The toolbar appears or disappears, depending on its previous state.
99
111
100
112
## Follow a pointer through memory (C/C++)
101
113
102
114
In native code apps, you can use register names as live expressions. For example, you can use the stack pointer to follow the stack.
103
115
104
-
**To follow a pointer through memory:**
116
+
Follow a pointer through memory:
105
117
106
118
1. In the **Memory** window **Address** field, enter a pointer expression that is in the current scope. Depending on the language, you might have to dereference it.
107
119
@@ -117,4 +129,4 @@ To get the memory pointer address from a heap snapshot, open the heap dump, choo
117
129
118
130
## Related content
119
131
120
-
-[View data in the debugger](../debugger/viewing-data-in-the-debugger.md)
132
+
-[View data in the debugger](../debugger/viewing-data-in-the-debugger.md)
To install these components by using the manual installer, download and run the [Test Agent for Visual Studio](https://visualstudio.microsoft.com/vs/older-downloads/).
28
+
27
29
[!include[Visual Studio Test Agent 2019](includes/vs-2019/workload-component-id-vs-test-agent.md)]
To install these components by using the manual installer, download and run the [Test Agent for Visual Studio](https://visualstudio.microsoft.com/downloads/#agents-for-visual-studio-2022).
38
+
35
39
[!include[Visual Studio Test Agent 2022](includes/vs-2022/workload-component-id-vs-test-agent.md)]
To install these components by using the manual installer, download and run the [Test Controller for Visual Studio](https://visualstudio.microsoft.com/vs/older-downloads/).
28
+
27
29
[!include[Visual Studio Test Controller 2019](includes/vs-2019/workload-component-id-vs-test-controller.md)]
To install these components by using the manual installer, download and run the [Test Controller for Visual Studio](https://visualstudio.microsoft.com/downloads/#agents-for-visual-studio-2022).
38
+
35
39
[!include[Visual Studio Test Controller 2022](includes/vs-2022/workload-component-id-vs-test-controller.md)]
0 commit comments