There is no standard API call for that. This whole thing about free memory is a very complicated topic. Here is something I wrote on it a while ago:
http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android/2299813#2299813 <http://stackoverflow.com/questions/2298208/how-to-discover-memory-usage-of-my-application-in-android/2299813#2299813>The basic answer is, if you are caring about memory like this, you are probably in the process of driving yourself off a cliff. On Mon, Apr 18, 2011 at 7:14 PM, Andy Quan <androidr...@gmail.com> wrote: > Sorry, resending...clicked "reply" too quickly... > > Thanks for your advice. > > I am supporting some customers using our HW platform. It is said that in > android there is a standard API to calculate available memory by > "free"+"cached". This statistic does not contain "buffer". I wonder if this > is true. Or is there any misunderstanding? > > > On Mon, Apr 18, 2011 at 9:49 PM, Andy Quan <androidr...@gmail.com> wrote: > >> Thanks for your advice. >> >> I am supporting some customers using our HW platform. It is said that in >> android there is a standard API to calculate available memory by >> "free"+"cached". This statistic does not contain "buffer". I wonder if this >> is true. Or is there any misunderstanding? >> >> On Mon, Apr 18, 2011 at 2:32 PM, Dianne Hackborn >> <hack...@android.com>wrote: >> >>> To second that -- "free" memory is wasted memory. You don't *want* to >>> see lots of free memory. >>> >>> On Sun, Apr 17, 2011 at 11:22 PM, Suman Saraf <sumansa...@gmail.com>wrote: >>> >>>> Why do you think it impacts system performance? The kernel is using >>>> the free memory for caching pages and filesystem data. If indeed memory is >>>> required for other reasons it can quickly reclaim it from the caches. >>>> >>>> However, if you still want to try it, you can type: echo 3 > >>>> /proc/sys/vm/drop_caches >>>> >>>> >>>> Suman >>>> >>>> On 18-Apr-2011, at 11:46 AM, Andy Quan wrote: >>>> >>>> > Hi, >>>> > Is there any mechanism in kernel to flush memory reserved in "buffers" >>>> of meminfo into "free" category? After the system-up, android reserves huge >>>> memory inside "buffers" and "cached" but very little inside "free". I have >>>> concern that this impacts system performance. >>>> > >>>> > Any advice is appreciated! >>>> > >>>> > -- >>>> > Thanks, >>>> > Andy >>>> > >>>> > -- >>>> > unsubscribe: android-porting+unsubscr...@googlegroups.com >>>> > website: http://groups.google.com/group/android-porting >>>> >>>> -- >>>> >>>> unsubscribe: android-porting+unsubscr...@googlegroups.com >>>> website: http://groups.google.com/group/android-porting >>>> >>> >>> >>> >>> -- >>> Dianne Hackborn >>> Android framework engineer >>> hack...@android.com >>> >>> Note: please don't send private questions to me, as I don't have time to >>> provide private support, and so won't reply to such e-mails. All such >>> questions should be posted on public forums, where I and others can see and >>> answer them. >>> >>> >> >> >> -- >> Thanks, >> Andy >> > > > > -- > Thanks, > Andy > > -- > unsubscribe: android-porting+unsubscr...@googlegroups.com > website: http://groups.google.com/group/android-porting > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting