Skip to content

a5c-ai/babysitter / library/specializations/desktop-development/skills/electron-memory-profiler

electron-memory-profiler

Verified

Profile Electron app memory usage, detect leaks, analyze renderer process memory, and optimize memory consumption

FileKindSize
README.mdmarkdown2.0 KB
SKILL.mdskill md7.7 KB
# electron-memory-profiler

Profile Electron app memory usage, detect leaks, and optimize memory consumption.

## Overview

This skill provides comprehensive memory profiling capabilities for Electron applications. It helps identify memory leaks, analyze heap usage, and optimize memory consumption in both main and renderer processes.

## Quick Start

```javascript
const result = await invokeSkill('electron-memory-profiler', {
  projectPath: '/path/to/electron-app',
  profilingMode: 'leak-detection',
  targetProcess: 'all',
  duration: 60
});
```

## Features

### Profiling Modes

| Mode | Description |
|------|-------------|
| snapshot | Single point-in-time memory analysis |
| timeline | Memory usage over time |
| leak-detection | Identify growing memory patterns |
| comparison | Compare before/after snapshots |

### Metrics Captured

- Heap size (used/total)
- RSS (Resident Set Size)
- External memory
- DOM node count
- Event listener count
- V8 heap statistics

## Output

```json
{
  "success": true,
  "memoryProfile": {
    "mainProcess": {
      "heapUsed": 45,
      "heapTotal": 67,
      "external": 12,
      "rss": 120
    },
    "rendererProcesses": [
      {
        "pid": 12345,
        "heapUsed": 85,
        "domNodes": 1250,
        "eventListeners": 45
      }
    ]
  },
  "leaks": [
    {
      "type": "EventListener",
      "location": "src/renderer/components/DataGrid.js",
      "retainedSize": 5242880,
      "count": 150
    }
  ],
  "recommendations": [
    "Remove event listeners in component cleanup",
    "Use WeakMap for caching DOM references"
  ]
}
```

## Common Leak Patterns

1. **Event listeners** - Not removed on component unmount
2. **IPC handlers** - Accumulating channel listeners
3. **Closures** - Large objects retained in callback closures
4. **BrowserWindow references** - Not cleaned on window close

## Related Skills

- `electron-ipc-security-audit`
- `startup-time-profiler`

## Related Agents

- `electron-architect`
- `performance-test-engineer`
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall