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: support/windows-server/performance/troubleshoot-application-service-memory-leaks.md
+14-14Lines changed: 14 additions & 14 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
-
title: Application or service memory leaks troubleshooting guidance
2
+
title: Application or Service Memory Leaks Troubleshooting Guidance
3
3
description: Provides guidance on how to troubleshoot application or service memory leaks.
4
-
ms.date: 07/22/2025
4
+
ms.date: 07/24/2025
5
5
manager: dcscontentpm
6
6
audience: itpro
7
7
ms.topic: troubleshooting
@@ -12,15 +12,15 @@ ms.custom:
12
12
---
13
13
# Application or service memory leaks troubleshooting guidance
14
14
15
-
This article provides guidance to troubleshoot applications or services with memory leak behaviors and how to proceed.
15
+
This article provides guidance on troubleshooting applications or services with memory leak behaviors and how to proceed.
16
16
17
17
_Applies to:_ All supported versions of Windows Server and Windows Client
18
18
19
19
You see Event ID 2004 repeatedly in the system log. As the event source mentions, there's a resource exhaustion in the system on the virtual memory space. The description lists the system's top memory consumers at that time.
20
20
21
21
Apart from this event, you also notice high memory consumption by checking live or historical data from monitoring tools, or by using the Windows Task Manager.
22
22
23
-
The following troubleshooting process is helpful for both scenarios where first-party and third-party processes might be leaking memory. For first-party processes, you can use the public symbol store available. However, if you can't see the actual function in a third-party process, you can engage the vendor for further checking. Even if the function doesn't show, the allocation stack should indicate a third-party module.
23
+
The following troubleshooting process is helpful for both scenarios where first-party and third-party processes might be leaking memory. For first-party processes, you can use the public symbol store available. However, if you can't see the actual function in a third-party process, you can engage the vendor for further check. Even if the function doesn't show, the allocation stack should indicate a third-party module.
24
24
25
25
## Before you begin
26
26
@@ -50,17 +50,17 @@ Here are some examples:
50
50
51
51
:::image type="content" source="./media/troubleshoot-application-service-memory-leaks/task-manager-virtual-memory-commit-size.png" alt-text="Screenshot of Task Manager showing the VirtMemTest32 process with high commit size.":::
52
52
53
-
You can use [VMMap](/sysinternals/downloads/vmmap) and [Windows Performance Toolkit](/windows-hardware/test/wpt) for the troubleshooting.
53
+
You can use [VMMap](/sysinternals/downloads/vmmap) and [Windows Performance Toolkit](/windows-hardware/test/wpt) for troubleshooting.
54
54
55
55
VMMap is used to determine the type of memory leaks. The Windows Performance Toolkit includes the Windows Performance Recorder (WPR) tool and the Windows Performance Analyzer (WPA) tool, which are used to collect and analyze data.
56
56
57
57
## Gather data
58
58
59
-
During this stage, if the memory usage is growing over time and not releasing, which indicates a leak pattern. The increase doesn't need to be a straight line to fall into this pattern, the key point is that the memory usage keeps on increasing over time.
59
+
During this stage, if the memory usage is growing over time and isn't released, it indicates a leak pattern. The increase doesn't need to be a straight line to fall into this pattern. The key point is that the memory usage keeps on increasing over time.
60
60
61
61
:::image type="content" source="./media/troubleshoot-application-service-memory-leaks/increase-leak-pattern.png" alt-text="Screenshot of the memory usage with an increase pattern.":::
62
62
63
-
At this point, with a leak pattern, you need to determine the leaking memory type. Open VMMap and select the process that has been identified as the leaking memory.
63
+
At this point, with a leak pattern, you need to determine the leaking memory type. Open VMMap and select the process that is identified as the leaking memory.
### Collect trace data for virtual allocation memory
117
117
118
-
With the way to identify the leaking memory, the next step is to collect reproducible data to determine the driver responsible for the leaking allocations.
118
+
Since you have the way to identify the leaking memory, the next step is to collect reproducible data to determine the driver responsible for the leaking allocations.
119
119
120
120
Use the following command to collect data when the process shows the behavior. **WPR.exe** is included natively on operating systems after Windows 10 or Windows Server 2016.
Allow the process to run for some time. You can monitor the growth of memory consumption with Task Manager (**Commit size**).
129
129
130
-
Since it only collects virtual allocation data, the trace file won't grow that large, so you can let it run for several minutes. Once you see enough leaked memory, stop the trace by using the following command:
130
+
Since it only collects virtual allocation data, the trace file doesn't grow so large, so you can leave it running for several minutes. Once you see enough leaked memory, stop the trace by using the following command:
> If the process is running when you run the command, restart the process for the setting to be enabled.
150
150
151
-
Heap tracing was successfully enabled for process **VirtMemTest64.exe**.
151
+
Heap tracing is successfully enabled for process **VirtMemTest64.exe**.
152
152
153
153
The result is:
154
154
@@ -157,7 +157,7 @@ Value name: `Tracing Flags`
157
157
Value type: `REG_DWORD`
158
158
Value data: `0x00000001 (1)`
159
159
160
-
You can delete the registry key or set the value to `0` after the troubleshooting.
160
+
You can delete the registry key or set the value to `0` after troubleshooting.
161
161
162
162
Use the following command to collect data when the process shows the behavior. **WPR.exe** is included natively on operating systems after Windows 10 or Windows Server 2016.
163
163
@@ -169,7 +169,7 @@ C:\>wpr -start Heap
169
169
170
170
Allow the process to run for some time. You can monitor the growth of memory consumption with Task Manager (**Commit size**).
171
171
172
-
Since it only collects heap data, the trace file won't grow that large, so you can let it run for several minutes. Once you see enough leaked memory, stop the trace by using the following command:
172
+
Since it only collects heap data, the trace file doesn't grow so large, so you can leave it running for several minutes. Once you see enough leaked memory, stop the trace by using the following command:
173
173
174
174
```console
175
175
C:\>wpr -stop Heap.etl
@@ -183,13 +183,13 @@ Open WPA and set up the symbol path. In the menu, select **Trace** > **Configure
183
183
184
184
### Analyze trace data for virtual allocation memory
185
185
186
-
Replicate the following view by replacing the process with the one you've identified as relevant. Ensure that the **Commit Stack** column is on the left of the gold/yellow line. Drill down by expanding the stack, and you'll see the function that shows the allocation of virtual memory. The driver listed before (up) the function is the one calling to that operation.
186
+
Replicate the following view by replacing the process with the one you've identified as relevant. Ensure that the **Commit Stack** column is on the left of the gold/yellow line. Drill down by expanding the stack, and you see the function that shows the allocation of virtual memory. The driver listed before (up) the function is the one calling to that operation.
187
187
188
188
:::image type="content" source="./media/troubleshoot-application-service-memory-leaks/trace-data-virtual-allocation.png" alt-text="Screenshot of the analysis trace data for virtual allocation memory." lightbox="./media/troubleshoot-application-service-memory-leaks/trace-data-virtual-allocation.png":::
189
189
190
190
### Analyze trace data for heap allocation memory
191
191
192
-
Replicate the following view by replacing the process with the one you've already identified as relevant. Ensure that the **Handle** and **Stack** columns are on the left of the gold/yellow line. Drill down by expanding the stack, and you'll see the function that shows the allocation of heap memory. The driver listed before (up) the function is the one calling to that operation.
192
+
Replicate the following view by replacing the process with the one you've already identified as relevant. Ensure that the **Handle** and **Stack** columns are on the left of the gold/yellow line. Drill down by expanding the stack, and you see the function that shows the allocation of heap memory. The driver listed before (up) the function is the one calling to that operation.
193
193
194
194
> [!NOTE]
195
195
> If you don't see the heap allocation graph, it's because the registry key isn't set correctly. Review the steps.
0 commit comments