Wednesday, August 10, 2011

[android-developers] System misreporting free system memory?

Hey all,

We've just finished a launch and we're getting sporadic reports of our
app detecting far less free memory on the working drive than the
system itself reports. On our test devices we're not seeing this, but
on some user devices they're getting reports of ~7mb free, while the
system reports (in Settings) that they have 200mb free.

I should note that our detection method is as follows:

StatFs stat = new StatFs(context.getFilesDir().getAbsolutePath());
long bytesAvailable = (long)stat.getBlogSize() *
(long)stat.getAvailableBlocks();
return bytesAvailable / (1024.f * 1024.f);

As I said, on every test device of ours this reports the exact amount
that is otherwise shown by the system, but in the field it's
occasionally grossly underreporting the amount of memory available. Is
there another way to detect free system memory? Am I missing something?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment