iOS使用Xcode Memory Graph Debugger

2018-07-22  本文已影响168人  AprSnow

原文iOS — Identifying Memory Leaks using the Xcode Memory Graph Debugger

这篇文章主要介绍

What is it

长话短说, memory graph debugger回答了为什么一个对象存在内存中?

Xcode memory graph debugger可以帮助找到和修复循环引用与内存泄露。当被激活时,会暂停app运行,展现当前堆中的对象,对象的关系,对象间的引用。

How to use it

3个步骤检查循环引用和内存泄露

Enable Malloc stack logging for live allocations The memory graph debugging button Xcode memory graph debugging mode

左边展示app堆中的内容

选中一个实例可以在中间展现实例的引用

选中中间的实例可以生成对象的内存信息,内存泄露信息如下:

Leaks displayed in the debug navigator

Tips

Filtering for memory leaks Lots of (apparent) memory leaks

The good and the bad

Useful links

上一篇 下一篇

猜你喜欢

热点阅读