"an error occurred trying to capture leaks data"

When I try to run my iOS app through the Leaks instrument in the simulator, very shortly after launch, without fail, it will stop with the error "An error occurred trying to capture Leaks data"


All the disclosure says is "Error retrieving leak information." I can't find any other information. Checking the console view, it just shows a normal run up until "<End of Run>"


I've tried doing a clean build, deleting my derived data, uninstalling the app from the simulator, restarting Xcode, rebooting. I have no idea what to do.

On an actual device with XCode 11.4.1 I'm having same problem "No reply dictionary received from LeakAgent request."


But I can get the memory node graphs to work when running in 13.4 simulator.

I found this same problem in Xcode 11.5 (11E608c)

Confirmed on Instruments Version 11.4 (11E146).

Anyone got a workaround?

Same error when trying to run Leaks for a macOS application (compiled in debug mode) from the GUI and the command line (instruments -t Leaks program_name):

Terminal output:
Code Block
[ERROR] Run issues detected (trace is still ready to be viewed):
* Error retrieving leak information.
* An error occurred trying to capture Leaks data.
* Error retrieving leak information.

Instruments Version 11.5 (11E608c) (64535.75)
I've found a solution to my problem and I hope it is useful for other users in this thread: If you are compiling with -fsanitize=address, remove the -fsanitize=address flag and try again, it looks like Leaks doesn't like the AddressSanitizer.
It looks to me like the Leaks Instrument times out before the app fully initialises. A workaround for this seems to be to start Instruments from within Xcode once the app is running.

In other words; start the app in Xcode, go to the Debug Navigator, click the Memory item there and then in the main window click Profile in Instruments (top right). That should take you right into the Leaks Instrument running against your app.
@benjfromlondon Unfortunately your solution is not working in Xcode 11.3.1 . It is quite surprising this issue is still open.
I have the same problem on Xcode 12.0.1 (12A7300). Also i've noticed that only Leaks stop working with an error, if I try Allocations instrument it works fine. Im profiling on a device (iPhone 7 Plus, iOS 13.2.3)
Hi gooduser1,

Can you please provide exact error that you're getting when using Leaks?
Also, it would be useful to gather a sysdiagnose with logs from the system when the process launch fails.

Would you be able to file a feedback report to us and attach the number here?


Thanks so much for your feedback.
I am also seeing this on Xcode 12.1 (12A7403) when trying to use "Debug Memory Graph" for iOS12 simulators.

same issues, Xcode 12.4. iOS14.5.1 or iOS15.0.1

`An error occurred trying to capture Leaks data.   
Unable to invoke -[<DTLeaksService:0x123d3c180> requestLeaskForPid:context:provideBacktraces:- it does not respond to the selector]`

5 years later, still the same problem.

Xcode 16.1. Same error: "Failed to attach to target process", "Failed to acquire memory location for pushing shared memory into target." Feedback issue: FB15773948.

"an error occurred trying to capture leaks data"
 
 
Q