Memory Optimization

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

作者 aj-geddes3f5182cfd739无许可证355 个星标收录于 2026年10月8日更新于 2026年10月8日仓库7个月前更新

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

AI 生成的概览

指导分析并优化应用内存使用,发现内存泄漏并降低内存占用。

功能
该技能提供分析和优化应用内存使用的指导。内容涵盖识别内存泄漏、降低内存占用,以及提升性能与可靠性方面的效率。它指向内存分析、泄漏检测、优化技术和监控目标等参考指南,并包含浏览器与 Node.js 分析的快速入门示例。
适用场景
当应用出现内存占用过高、疑似内存泄漏、性能缓慢、内存不足崩溃或扩展困难时使用。它用于诊断并降低运行中应用的内存消耗。
运行要求
不附带脚本,仅为说明与参考文档。分析示例涉及浏览器开发者工具和 Node.js 检查,因此执行所述工作需要使用这些工具。

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

来源与署名

来源:aj-geddes/useful-ai-prompts位于skills/memory-optimization提交3f5182c

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架