debug-memory-leak
Skill0 starsChanged 3 months agoMITView on GitHub
Debug memory leaks in the application
In this repository66 other files it gives its agents.
- adb-android-app-opsSkill
- agents-sdkSkill
- api-documentationSkill
- atlasSkill
- backend-api-auth-guardrailsSkill
- browser-useSkill
- bundleSkill
- changelogSkill
- chatgpt-appsSkill
- chrome-devtools-testSkill
- chronicleSkill
- cloudflare-deploySkill
- cloudflare-email-serviceSkill
- cloudflare-one-migrationsSkill
- cloudflare-oneSkill
- cloudflareSkill
- computer-useSkill
- create-planSkill
- database-analysisSkill
- database-data-guardrailsSkill
- deep-initSkill
- deploySkill
- develop-web-gameSkill
- dev-workflowSkill
- docSkill
- durable-objectsSkill
- explainSkill
- figmaSkill
- firmware-feature-writerSkill
- fix-bugSkill
- fix-lintSkill
- frontend-mobile-uiux-designerSkill
- frontend-ui-guardrailsSkill
- gemini-cliSkill
- grok-x-searchSkill
- hermes-chromeSkill
- image-file-readerSkill
- imagegenSkill
- infra-ops-mobile-guardrailsSkill
- layout-reviewSkill
- localizeSkill
- multimodal-lookerSkill
- openai-docsSkill
- optimizeSkill
- parallel-devSkill
- plan-modeSkill
- playwrightSkill
- project-planningSkill
- qa-testerSkill
- refactorSkill
- review-changesSkill
- review-fix-shipSkill
- rust-programmerSkill
- sandbox-sdkSkill
- screenshotSkill
- security-auditSkill
- security-scanSkill
- security-threat-modelSkill
- source-command-collab-startSkill
- turnstile-spinSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 11 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Add memory tracking to the worker
- Distinctive: line 25
Check for unclosed connections or uncached data
- Distinctive: line 29
Durable Objects: Check for unclosed WebSocket connections
- Distinctive: line 30
KV Storage: Verify proper cleanup of large values
- Distinctive: line 31
Caches: Ensure cache size limits are enforced
- Very specific: line 44
Add explicit cleanup in Durable Object close() methods
- Distinctive: line 46
Use weak references where appropriate
- Distinctive: line 47
Ensure proper error handling to prevent resource leaks
- Distinctive: line 50
Run load tests with memory monitoring
- Distinctive: line 51
Verify memory usage stabilizes after garbage collection
- Distinctive: line 52
Check for memory growth under sustained load
- Very specific: line 56
Use console.log with memory usage timestamps
- Distinctive: line 58
Check for event listener leaks
- Very specific: line 60
Use WeakMap or WeakSet for temporary object storage
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debug Memory Leak Workflow
This workflow helps identify and debug memory leaks in the Cloudflare Workers application.
Steps
- Enable Memory Debugging
- Add memory tracking to the worker
- Enable detailed logging for memory usage
- Set up memory profiling hooks
- Collect Memory Metrics
# Check current memory usage patterns wrangler tail --format=json | jq '.event' | grep -i memory - Analyze Heap Usage
- Review object allocation patterns
- Check for unclosed connections or uncached data
- Identify long-lived objects that should be garbage collected
- Common Memory Leak Sources
- Durable Objects: Check for unclosed WebSocket connections
- KV Storage: Verify proper cleanup of large values
- Caches: Ensure cache size limits are enforced
- Async Operations: Confirm all futures are properly awaited
- Debugging Commands
# Monitor memory usage over time wrangler tail --format=pretty | grep "Memory usage" # Check for hanging promises wrangler tail --format=json | jq '.log[] | select(.message | contains("promise"))' - Fix Common Issues
- Add explicit cleanup in Durable Object
close()methods - Implement cache eviction policies
- Use weak references where appropriate
- Ensure proper error handling to prevent resource leaks
- Add explicit cleanup in Durable Object
- Validate Fixes
- Run load tests with memory monitoring
- Verify memory usage stabilizes after garbage collection
- Check for memory growth under sustained load
Tips
- Use
console.logwith memory usage timestamps - Monitor Durable Object lifecycle closely
- Check for event listener leaks
- Review async/await patterns for unresolved promises
- Use
WeakMaporWeakSetfor temporary object storage
Related Files
src/lib.rs- Main worker entry pointsrc/durable_objects/- Durable Object implementationssrc/services/cache.rs- Cache managementsrc/middleware/- Request/response handling
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

