How to locate block code

Viewed 256

In Debug Memory Graph I've got a custom view captured by a __NSMallocBlock__ The block's description is just

<__NSMallocBlock__: 0x600000a5f7a0> So how can I locate the block code now?

1 Answers

You should edit your scheme settings, and under “Diagnostics” » “Logging” and enable “Malloc Stack”.

enter image description here

Then, when select the “Memory Inspector”, you’ll see your stack trace:

enter image description here

You can even click on the arrow next to your method name in the stack and it will jump you to that portion of code where this block was allocated. In my example above, the block was allocated in viewDidLoad.


Make sure to turn off this setting when you’re done with your diagnostics.

Related