新的空iOS应用有数十个内存泄漏 [英] New empty iOS app has dozens of memory leaks
问题描述
在全新的,从头开始的单视图iOS应用程序上使用泄漏仪器工具会报告23处泄漏.这似乎不正确-我错过了什么吗?重复运行会产生不同的泄漏计数,从16到35.重现步骤遵循此屏幕截图.
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.
一个类似的未解决的问题发布在内存泄漏中使用亚马逊示例ios应用登录
A similar, unanswered question, was posted at Memory leak in login with amazon sample ios app
我正在使用Xcode 10.2.1(10E1001); iOS 12.2(模拟器和设备均显示泄漏,无论是否激活显示".)
I'm using Xcode 10.2.1 (10E1001); iOS 12.2 (Simulator & device both show leaks, with or without Reveal activated.)
- 创建新的单视图iOS应用.
- 在方案">运行/调试"部分中,启用
- 内存管理> Malloc涂鸦
- 记录> Malloc堆栈(仅实时分配)
- Create fresh one-view iOS app.
- In Scheme > Run/Debug section, enable
- Memory Management > Malloc Scribble
- Logging > Malloc Stack (Live Allocations Only)
但是,除Instruments之外,Debug Navigator并不同意:
However, apart from Instruments, Debug Navigator disagrees:
- 运行普通的调试会话
- 单击调试"区域顶部的调试内存图".
- Debug Navigator(如下)没有紫色感叹号(泄漏警报).
推荐答案
Xcode 10.3的发行说明说:
The release notes for Xcode 10.3 say:
解决了一个问题,其中在Leaks仪器下在iOS 12.2或更高版本中运行应用程序后,在给定运行中的第一次泄漏检查之后,每次泄漏检查都会产生随机数量的假阳性泄漏
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
听起来完全像这个问题.因此,这是一个错误(Heisenbug?),现在已修复.
That sounds exactly like this issue. So it was a bug (a Heisenbug?), and now it’s fixed.
这篇关于新的空iOS应用有数十个内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!