New empty iOS app has dozens of memory leaks

廉价感情. 提交于 2019-12-21 11:36:08

问题


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.)

  1. Create fresh one-view iOS app.
  2. In Scheme > Run/Debug section, enable
    • Memory Management > Malloc Scribble
    • Logging > Malloc Stack (Live Allocations Only)
  3. Run Product > Profile (⌘I)
  4. First leak check is green; wait for second one.
  5. Twenty-three new leaks! (As shown above.)

However, apart from Instruments, Debug Navigator disagrees:

  1. Run normal debug session
  2. Click "Debug Memory Graph" at top of Debug area.
  3. Debug Navigator (below) has no purple exclamation marks (leak alerts).


回答1:


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.



来源:https://stackoverflow.com/questions/56174297/new-empty-ios-app-has-dozens-of-memory-leaks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!