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: skills/memory-leak-debugging/SKILL.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,21 +15,23 @@ This skill provides expert guidance and workflows for finding, diagnosing, and f
15
15
16
16
## Workflows
17
17
18
-
### 1. Using Memlab (Recommended)
18
+
### 1. Capturing Snapshots
19
19
20
-
When users provide `.heapsnapshot` files or want to find a memory leak, use `memlab` to automatically find memory leaks.
20
+
When investigating a frontend web application memory leak, utilize the `chrome-devtools-mcp` tools to interact with the application and take snapshots.
21
+
- Use tools like `click`, `navigate_page`, `fill`, etc., to manipulate the page into the desired state.
22
+
- Revert the page back to the original state after interactions to see if memory is released.
23
+
- Repeat the same user interactions 10 times to amplify the leak.
24
+
- Use `take_memory_snapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
21
25
22
-
- Read [references/memlab.md](references/memlab.md) for how to use `memlab` to analyze existing heapsnapshots or run automated E2E test scenarios to find leaks.
26
+
### 2. Using Memlab to Find Leaks (Recommended)
27
+
28
+
Once you have generated `.heapsnapshot` files using `take_memory_snapshot`, use `memlab` to automatically find memory leaks.
29
+
30
+
- Read [references/memlab.md](references/memlab.md) for how to use `memlab` to analyze the generated heapsnapshots.
23
31
- Do **not** read raw `.heapsnapshot` files using `read_file` or `cat`.
24
32
25
-
### 2. Identifying Common Leaks
33
+
### 3. Identifying Common Leaks
26
34
27
35
When you have found a leak trace (e.g., via `memlab` output), you must identify the root cause in the code.
28
36
29
37
- Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them.
30
-
31
-
### 3. Creating Memlab Scenarios
32
-
33
-
To help users reproduce and test for leaks automatically, you can create a Memlab scenario file.
34
-
35
-
- An example template is available at `scripts/memlab-scenario.js`.
Copy file name to clipboardExpand all lines: skills/memory-leak-debugging/references/memlab.md
+9-13Lines changed: 9 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,25 @@
4
4
5
5
## Important Rule
6
6
7
-
**NEVER read raw `.heapsnapshot` files directly.** They are too large and will exceed context limits. Use `memlab` commands to analyze them instead.
7
+
**NEVER read raw `.heapsnapshot` files directly.** They are too large and will exceed context limits. Always use `memlab` commands to analyze them.
8
8
9
-
## Analyzing Existing Snapshots
9
+
## Analyzing Snapshots
10
10
11
-
If the user provides 3 snapshots (baseline, target, final), you can use `memlab` to find leaks:
11
+
You can use the `take_memory_snapshot` tool provided by the `chrome-devtools-mcp` extension to generate heap snapshots during an investigation. To find leaks, you generally need 3 snapshots:
12
+
1.**Baseline:** Before the suspect action.
13
+
2.**Target:** After the suspect action.
14
+
3.**Final:** After reverting the suspect action (e.g., closing a modal, navigating away).
15
+
16
+
Once you have these 3 snapshots saved to disk, you can use `memlab` to find leaks:
0 commit comments