2026-04-30 · 4 min
Xcode Instruments, Memory Graph and residue testing: which answers what
Instruments and the Memory Graph find leaked objects and measure memory. They don't search for secret values. When to use each, and how they fit together after logout.
Quick summary
- • Instruments and the Memory Graph answer “which objects are alive and how much memory is used”.
- • A residue test answers “which secret values are still reachable after logout, and where”.
- • Use them together: the residue test finds the value, the Memory Graph finds the object holding it.
What Instruments and the Memory Graph are for
Allocations, Leaks and the Memory Graph Debugger show objects, retain cycles and how much memory the app uses. They are the right tools for performance work and for objects that leak.
What they don't answer
They don't search memory or the app's container for secret values, and they don't compare state before and after logout. A token in UserDefaults or a response cached in Cache.db is not a “leak” to Instruments.
What a residue test adds
A residue test looks for values: tokens, keys, card numbers, e-mail addresses. It captures before and after a flow such as logout and reports which values survived and where. It doesn't measure performance.
Using them together
When a residue test shows a token still in memory after logout, open the Memory Graph to find the object that holds it: a session store, a view model, a closure. Fix the owner, then run the residue check again until it passes.
FAQ
Is WatchMemory a replacement for Instruments?
No. It doesn't profile performance or find leaked objects. It checks whether sensitive values are gone after logout.
Does WatchMemory show which object holds a secret?
Not yet. Today it shows where the value is: memory, or the file, store and key. Use the Memory Graph to find the owning object; a “who holds it” view is on the roadmap.
For more guides, visit WatchMemory Blog.
WatchMemory's Mac app is local-first: scans stay on your machine. Web analytics are privacy-friendly and used only to improve the website.