Getting the free, used and total run time memory as consumed by an App is very useful for debugging Out of Memory situations (leads to app crash). The following snippet shows how to get the memory details in MB.
public static long getUsedMemorySize() { long freeSize = 0L; long totalSize = 0L; long usedSize = -1L; try { // get handle to run time Runtime info = Runtime.getRuntime(); // get various memory buckets freeSize = info.freeMemory() / 1048576L; totalSize = info.totalMemory() / 1048576L; usedSize = totalSize - freeSize; Log.i("Memory total: " + totalSize + "MB and used:" + usedSize + "MB free:" + freeSize + "MB"); } catch (Exception e) { e.printStackTrace(); } return usedSize; }