Could anyone share suggestions or ways to check memory in the Xamarin.Android platform using Xamarin Studio?
I have tried with the below option available in Xamarin Studio,
Tools > Instruments > Allocations
But in that, I can select only iOS devices in the options as in below image,
Is there any solution for this?
Profilers: Profiler is a great tool to analyze the application behavior and check for memory leaks. They can also be combined with native instruments to check memory allocations of native objects. I hope you already know how to use them as we have discussed xamarin profilers in PART- A.
You can use the Android Profiler to measure the performance of a Xamarin Android app built with Visual Studio – without the need for a Visual Studio Enterprise license.
Sadly, but you can't do it from Xamarin Studio in any reliable way. You can try profiler, but it requires Enterprise license. My suggestion is to use standard Android tools.
PREPARATION:
1) Download "Eclipse Memory Analyzer"
2) Find Android Device Monitor. Bundled with Android SDK and can be found at "Android-SKD/tools/monitor". You can find out location of that folder by opening Xamarin, pressing CMD + , and selecting SDK Locations.
3) Find Heap Snapshot converter (from Android to Java). Bundled with Android SDK and can be found at "Android-SDK/platform-tools/hprof-conv"
CAPTURE:
1) Install application with debug mode on device
2) Connect device to PC and launch monitor (2 step at preparation)
3) Launch the application and find it by application ID in devices.
4) Press Update Heap (icon to the right from bug icon)
5) Do stuff that you think makes leaks
6) Press Save Heap (icon to the right of start) and save it to the drive
RETRIEVER RESULTS:
1) Convert android Heap to Java Heap
1.1) Launch terminal
1.2) Locate Heap Shanpshot converter (hprof-conv) (3 step at preparation)
1.3) drop hprof-conv to terminal
1.4) drop Android heap, and then, drop it next and rename it. It will create correct copy in the same location with chosen name
android-sdk-macosx/platform-tools/hprof-conv raw.hprof converted.hprof
2) Open Eclipse Memory Analyzer (1 step at preparation)
3) Import acquired Head Dump
3) Select Leak Suspects Report
4) View results
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With