4
votes

I'm currently developing a big application with Xamarin.I'm trying to fix some leaks that happens but whenever I use instruments Leaks or Allocation those tools make the app freeze and the recording stops taking anything.

Allocation stops logging image

Allocation stops logging image2

My app is in Debug mode as stated in this link:
Xcode Instruments stops recording when iPad app leaves the splash screen

No particular crash in the logs and I have tried Enable NSZombie detection without success.

Dec 15 21:00:15 SU04 xxxxxxxxx[351] <Warning>: Using ThreadCount: 2
Dec 15 21:00:23 SU04 backboardd[28] <Warning>: CoreAnimation: updates deferred for too long
Dec 15 21:00:23 SU04 backboardd[28] <Warning>: CoreAnimation: timed out fence 2ecaf
Dec 15 21:00:23 SU04 SpringBoard[33] <Warning>: CoreAnimation: failed to receive fence reply: 10004003

At the startup, the application have to load a big amount of memory (part from xamarin, part from different SDK) and I suspect that those tools can't handle that. We are turning around 180Mo and 90Mo to 120Mo are loaded at startup but the tools make the app freeze before being fully functionnal.

Nobody of my team is able to profile using those tools so it is coming (imho) from the tools or application and not the configuration of my computer. I tried on simulator 7.x and 8.x, ipads 7.x and 8.x with the same result.

Any more idea of what I can try to solve this? Thanks :)

3

3 Answers

2
votes

Try clicking the "Only track VM Allocations" checkbox on the first tab of the right-hand bar.

I have a similar problem with Instruments and Xamarin, and while this gets the device beyond the splash screen (and working normally), you will likely notice that a lot of the useful allocation information is missing, sadly.

1
votes

Short Answer: Profile using the Release configuration

Long Answer:

The Debug configuration of Xamarin.iOS is very different from the one of Xcode. The link you gave was for Xcode and does not apply well to Xamarin.iOS.

Xamarin.iOS uses a soft-debugger which requires additional (generated) code and memory for debugging than a release build would.

That will often give you bad numbers, e.g. it takes a long longer than it should, and you can find yourself optimizing the wrong code (e.g. it might not be the slowest code part at release time). Same goes for memory usage (and instruments also has it's own requirement).

For time or memory you'll get the best results (data) with a build options that is the closest to what you plan to release.

1
votes

Have you tried recording in "deferred mode"? Live recording will impact CPU and Memory and it will slow down your application. By using "Deferred Mode" you delay the analysis until the end of the recording. Hope that helps.