Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode, Leaks instrument not working, "an error occurred trying to capture allocations data"

I'm trying to debug some memory leaks in an iOS application.

Previously I have used the Instruments/Leaks tool provided with XCode and the "Mark Generation" button in that tool to successfully locate sources of the memory leaks.

However, now I get the error in the title of this question.

There were some things to do that worked last time, at least this helped before:

  • Edit Scheme -> Run -> Run -> Diagnostics -> Enable: "Malloc stack"

This developer forums thread offers some work-arounds, like profiling with debug build, but that does not help, at least in my particular case.

Is there some other work-arounds or likely things I'm doing that prevent the Leak tool from working?

like image 561
Peter Lamberg Avatar asked Jan 15 '20 10:01

Peter Lamberg


People also ask

Why is my Xcode app using so much memory?

If the memory usage tends to increase as you use your app, then it’s likely that some memory isn’t being released appropriately. The Instruments tool provided with Xcode can give you valuable insight into the lifetime of objects used throughout your application.

How do I use the allocations and leaks instrument?

Under “Choose a profiling template for,” select your device and application (see troubleshooting if it’s disabled). Then select the Allocations instrument and click “Choose.” (It’s worth noting that the Leaks instrument can also be useful, but it is primarily used to detect memory that is never freed, not memory leaks from retain cycles.)

How to use Xcode’s leaks function?

Xcode’s leaks function is a very handy tool. We can simply press on the record button and navigate and perform actions throughout a large app, and the instrument will document new leaks in the report. We also have a way to save the recording and review it in the future: Thank you very much for reading!

How to create a memory leak in Xcode using retain cycle?

On the first screen, a button, on tap, let’s us navigate to the second screen, where we intentionally create a memory leak using a retain cycle. We open the Xcode leaks instrument first and press the record button When the app automatically launches, we press on the navigate button that presents our leaking view controller


1 Answers

One thing I noticed is that it gives that error when testing with iOS simulator, but when profiling on a real iOS device it works.

like image 61
Peter Lamberg Avatar answered Sep 22 '22 23:09

Peter Lamberg