aj-geddes avatar

Memory Optimization

This walks you through profiling and fixing memory issues in JavaScript applications, covering both browser and Node.js environments. You get concrete workflows for Chrome DevTools heap snapshots, React DevTools profiler, and the Node inspector. It includes separate reference guides for leak detection, optimization techniques, and monitoring targets. Use this when you're debugging OOM crashes, tracking down leaks, or trying to cut your cloud bills by reducing memory footprint. The quick start is more of a cheat sheet than a complete example, so you'll want to dig into the reference docs for actual implementation patterns.

skills.sh installs
552
GitHub stars
379
last updated
Aug 21, 2026

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill memory-optimization --agent claude-code

Installs into .claude/skills of the current project.

Files

Memory Optimization

Table of Contents

Overview

Memory optimization improves application performance, stability, and reduces infrastructure costs. Efficient memory usage is critical for scalability.

When to Use

  • High memory usage
  • Memory leaks suspected
  • Slow performance
  • Out of memory crashes
  • Scaling challenges

Quick Start

Minimal working example:

// Browser memory profiling

// Check memory usage
performance.memory: {
  jsHeapSizeLimit: 2190000000,    // Max available
  totalJSHeapSize: 1300000000,    // Total allocated
  usedJSHeapSize: 950000000       // Currently used
}

// React DevTools Profiler
- Open React DevTools → Profiler
- Record interaction
- See component renders and time
- Identify unnecessary renders

// Chrome DevTools
1. Open DevTools → Memory
2. Take heap snapshot
3. Compare before/after
4. Look for retained objects
5. Check retained sizes

Sponsors

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Categories
AI & Agent Building, Debugging
First seen
Jun 3, 2026

More from aj-geddes/useful-ai-prompts

All 258
1aj-geddes avatarsemantic-versioningaj-geddes/useful-ai-promptsImplement semantic versioning (SemVer) with automated release management. Use conventional commits, semantic-release, and version bumping strategies.552skills.sh installs
2pbakaus avatarresolve-reviewspbakaus/agent-reviewsResolve all PR review comments (human and bot) on current PR. Fetches unanswered comments, evaluates each one, fixes real issues, dismisses false positives, and552skills.sh installs
3aj-geddes avatarcaching-strategyaj-geddes/useful-ai-promptsImplement efficient caching strategies using Redis, Memcached, CDN, and cache invalidation patterns. Use when optimizing application performance, reducing datab551skills.sh installs
4getsentry avatarsentry-react-native-sdkgetsentry/sentry-agent-skillsFull Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or conf549skills.sh installs
5sanjay3290 avatarmssqlsanjay3290/ai-skillsExecute read-only SQL queries against multiple Microsoft SQL Server databases. Use when: (1) querying MSSQL/SQL Server databases, (2) exploring database schemas549skills.sh installs
6aj-geddes avatarreal-time-featuresaj-geddes/useful-ai-promptsImplement real-time functionality using WebSockets, Server-Sent Events (SSE), or long polling. Use when building chat applications, live dashboards, collaborati548skills.sh installs