Search code examples
iosxcodeinstrumentsxcode-instruments

Xcode Instruments 10.12.1 showing memory leaks on an default project


Replicate:

  • Create a default 12.2 target Swift 5 project - with nothing changed.
  • Profile with Leaks in Instruments.
  • Tap screen a few times.
  • 66 memory leaks (although the number is not consistent) after short period of time.

This occurs in various Simulators and when testing on various Phones. Not expecting so many memory leaks on a default app with no modification.

Using: - MacOS 10.14.5 (18F132) - Xcode 10.2.1 (10E1001) - Instruments 10.2.1 (10E1001)

I have filed a report to Apple, as this makes Instruments kind of meaningless.


Solution

  • Paul Hudson discussed this in a Hacking with Swift video (https://youtu.be/cR4Wc4JGOMg?t=31). The discussion is about a minute long.

    The gist of it is that simulators shouldn't be used for profiling. Use a real hardware device for profiling.