Using the Leaks Instruments tool on a new, from-scratch, one-view iOS app reports 23 leaks. This doesn't seem right — am I missing something? Repeated runs yield different leak counts, from 16 to 35. Steps to reproduce follow this screenshot.
A similar, unanswered question, was posted at Memory leak in login with amazon sample ios app
I'm using Xcode 10.2.1 (10E1001); iOS 12.2 (Simulator & device both show leaks, with or without Reveal activated.)
However, apart from Instruments, Debug Navigator disagrees:
A memory leak occurs when allocated memory becomes unreachable and the app can't deallocate it. Allowing an allocated-memory pointer to go out of scope without freeing the memory can cause a memory leak. A retain cycle in your app's object graph can also cause a memory leak.
Xcode's Memory Graph Debugger If you haven't used this yet, it's easy to access while developing. Tapping on the icon will pause your application and generate a graph of the objects with their references to other objects. If there's leaked memory detected, you will see purple icons on the left pane of Xcode.
Memory leaks are a common error in programming, especially when using languages that have no built in automatic garbage collection, such as C and C++. Typically, a memory leak occurs because dynamically allocated memory has become unreachable.
The release notes for Xcode 10.3 say:
Resolved an issue where running an app in iOS 12.2 or later under the Leaks instrument resulted in random numbers of false-positive leaks for every leak check after the first one in a given run
That sounds exactly like this issue. So it was a bug (a Heisenbug?), and now it’s fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With