Why total memory extracted from getRuntime().totalMemory()
is not equal with when we use ActivityManager.MemoryInfo()
? In below two code part I get different values:
long totalMemory = Runtime.getRuntime().totalMemory() ;
and
ActivityManager actManager = (ActivityManager) getActivity().getSystemService(ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo();
actManager.getMemoryInfo(memInfo);
long totalMemory = memInfo.totalMem
in first code I get 12.759.040 and from the second code I get 907.034.624 !