Home > Software engineering >  How to locate memory leak causes only by memory address in swift?
How to locate memory leak causes only by memory address in swift?

Time:08-25

I have some memory leaks in my project, it seems like a closure or cycle reference issue, but I only have memory address.

How can I find certain function or closer that causes memory leaky by memory address?

enter image description here

---------Update ---------

Thanks to @DarkDust, the info of memory address is under inspector tab.

enter image description here

CodePudding user response:

Edit your scheme, select the "Run" section on the left and then the "Diagnostics" tab. Here, enable "Malloc Stack Logging" (you may need to disable runtime sanitizers if this option is greyed out).

Then run your app again. You can now view a stack trace generated at the time a specific memory area was allocated in the inspector.

See for example this tutorial or this one.

  • Related