Hi,

I was wondering about the best way to measure the remaining RAM on a
device. I have jusrt been using the emulator so far, and I connected
to the emulator using the "adb shell" command to get a Linux prompt
and used the vmstat command, in good old UNIX fashion, and got the
followoing output:

r  b    free mapped   anon   slab    in   cs  flt  us ni sy id wa ir
0  0   42236  21820  30700   3176    52   10    0   1  0  0 99  0  0


which I would interpret as 42236 kB of free RAM.

Then I tried to check this via a Java program and used the
MemoryInfo.availMem function as follows:

        mgr = (ActivityManager) super.getSystemService
(Context.ACTIVITY_SERVICE);
        memInfo = new ActivityManager.MemoryInfo();
        mgr.getMemoryInfo(memInfo);
        s = String.valueOf(memInfo.availMem);

and get a completely different result, it gives me about 88 MB
(88965120).

Which is the correct amount of remaining RAM in the device?

Thanks,

-Magnus

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to