Quick RxSwift memory leak detection for iOS. Finds missing dispose bags, retain cycles, and strong self references. Use when debugging memory issues, checking Observable subscriptions, or investigating retain cycles in RxSwift code.
/plugin marketplace add daispacy/py-claude-marketplace/plugin install py-plugin@py-claude-marketplaceThis skill is limited to using the following tools:
examples.mdFast, focused check for RxSwift memory management issues in iOS code.
Use Grep to locate all Observable subscriptions:
\.subscribe\(For every .subscribe(:
.disposed(by: disposeBag)[weak self] or [unowned self] in closuresviewModel.data
.subscribe(onNext: { data in })
// MISSING: .disposed(by: disposeBag)
viewModel.data
.subscribe(onNext: { data in
self.updateUI(data) // Strong self!
})
func loadData() {
let disposeBag = DisposeBag() // Local variable!
// Cancels immediately when function ends
}
Focused report with:
Pattern: \.subscribe\(
Context: Check next 5 lines for .disposed
Pattern: subscribe.*\{[^[]*self\.
Context: -A 3 -B 1
Pattern: let disposeBag = DisposeBag\(\)
# RxSwift Memory Check Report
## Critical Issues: X
### 1. Missing Disposal - MEMORY LEAK
**File**: `PaymentViewModel.swift:45`
**Risk**: Memory accumulation, eventual crash
**Current**:
```swift
// Missing disposal
Fix:
.disposed(by: disposeBag)
Impact: [Explanation]
🔴 Critical: X (memory leaks/retain cycles) ⚠️ Warnings: X (could use weak self)
✅ Clean files ⚠️ Files with warnings 🔴 Files with critical issues
## DisposeBag Best Practices
✅ **Correct**: Property-level DisposeBag
```swift
class ViewModel {
private let disposeBag = DisposeBag()
}
❌ Wrong: Local DisposeBag
func loadData() {
let disposeBag = DisposeBag() // Cancels immediately!
}
weak vs unowned[weak self] (safer)[unowned self] only if 100% sure self outlives subscription.disposed(by: disposeBag)[weak self] in closureSuggest verification:
Detailed Examples: See examples.md for extensive code samples and scenarios.