detect_retain_cycles
Detect potential memory leaks and retain cycles in Swift code by finding missing [weak self], strong delegates, Timer and NotificationCenter leaks, and strong ViewModel–ViewController references.
Instructions
Detect potential memory leaks and retain cycles in Swift code. Finds: missing [weak self] in closures, strong delegates, Timer retain cycles, NotificationCenter leaks, ViewModel↔ViewController strong references, and stored closure properties.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"projectPath": "<projectPath>"
},
"name": "detect_retain_cycles"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the Xcode project root directory | |
| targetPaths | No | Specific files/directories to analyze (default: entire project) | |
| excludePatterns | No | Glob patterns to exclude |