Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Programmatically determine memory used by app?

$
0
0

To help monitor/track down memory leaks, we need to know what memory our app is consuming.

This is for a Xamarin.Forms app; currently we're only running on Android, but will be on iOS in the future.

I know we can get the OS memory used on the device, in the Droid project, by using code like below:

public static MemoryInfo GetMemoryInfo()
{
        MemoryInfo retVal = new MemoryInfo();
        retVal.MaxMemory = Java.Lang.Runtime.GetRuntime().MaxMemory();
        retVal.FreeMemory = Java.Lang.Runtime.GetRuntime().FreeMemory();
        retVal.TotalMemory = Java.Lang.Runtime.GetRuntime().TotalMemory();

        return retVal;
}

Is there any mechanism for getting a figure for the memory being consumed in the Mono runtime?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>