Memory Optimization

aj-geddes/useful-ai-prompts/skills/memory-optimization

by aj-geddes3f5182cfd739No license355 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 7 months ago

Profile and optimize application memory usage. Identify memory leaks, reduce memory footprint, and improve efficiency for better performance and reliability.

Instructions onlySoftware Development
AI-generated overview

Guides profiling and optimizing application memory use, finding leaks and reducing memory footprint.

What it does
This skill provides guidance for profiling application memory usage and optimizing it. It covers identifying memory leaks, reducing memory footprint, and improving efficiency for performance and reliability. It points to reference guides on memory profiling, leak detection, optimization techniques, and monitoring targets, and includes a quick-start example of browser and Node.js profiling.
When to use it
Use it when an application shows high memory usage, suspected memory leaks, slow performance, out-of-memory crashes, or scaling challenges. It is meant for diagnosing and reducing memory consumption in running applications.
Requirements
No scripts are shipped; it is instructions and reference documents only. Profiling examples reference browser developer tools and Node.js inspection, so those tools are needed to carry out the described work.

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:

javascript
// Browser memory profiling
// Check memory usageperformance.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 DevTools1. Open DevTools → Memory2. Take heap snapshot3. Compare before/after4. Look for retained objects5. Check retained sizes
// Node.js profilingnode --inspect app.js// Open chrome://inspect// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Memory Profiling [blocked]Memory Profiling
Memory Leak Detection [blocked]Memory Leak Detection
Optimization Techniques [blocked]Optimization Techniques
Monitoring & Targets [blocked]Monitoring & Targets

Best Practices

✅ DO

  • Follow established patterns and conventions
  • Write clean, maintainable code
  • Add appropriate documentation
  • Test thoroughly before deploying

❌ DON'T

  • Skip testing or validation
  • Ignore error handling
  • Hard-code configuration values

Source and attribution

Source:aj-geddes/useful-ai-promptsinskills/memory-optimizationat commit3f5182c

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal