How to analyse Memory Availability of Android Testing Project

Both approaches worked for me, please using any of your choice,

Getting Runtime Memory using Runtime

static void checkMemory() {

double vTotalMem = Double.valueOf(Runtime.getRuntime().totalMemory());
double vMaxMem = Double.valueOf(Runtime.getRuntime().maxMemory());
double vAvailableMem = Double
.valueOf(Runtime.getRuntime().freeMemory());
print(“Runtime Memory info: TotalMem=”
+ Math.round(vTotalMem / 1048576) + “mb. MaxMemory”
+ Math.round(vMaxMem / 1048576) + ” mb. AvailableMemory=”
+ Math.round(vAvailableMem / 1048576) + ” mb.”);

}
Getting Memory using ActivityManager 

static void checkMemory() {
              ((ActivityManager)solo.getCurrentActivity()
                        .getSystemService(“activity”)).getMemoryInfo(mi);
              print(“Kernal Memory info: AvailableMemory=”+mi.
                         availMem/1048576+“mb IsMemLow=”+mi.lowMemory);
        if(mi.lowMemory) print(“memory is increasing”);
              else print(“Memory condition is fine”);
 
}