android: memory for kernel and apps

by Porting beginner » Fri, 12 Mar 2010 03:47:01 GMT


Sponsored Links
 Hi,

I have android running on my target platform.
When its booting, as kernel boots , I see free memory around 53mb-55mb range
there till console.
( cat /proc/meminfo )


*Just after kernel boot...
*

MemTotal:          88792 kB
*MemFree:           53496 kB
*Buffers:               0 kB
*Cached:            24028 kB*
.
.
.

But once android services/apps starts and reach to idle screen, most of
memory cached
*Once reach to Idle screen*

MemTotal:          88792 kB
*MemFree:           23228 kB ( keep changing in range of 23mb to 27 mb )*
*
*Buffers:              44 kB
*Cached:            20700 kB ( keep changing 19mb-25mb )
*


After this, if there is memory request from app , it seems android manage to
get it from cached

As I start more and more apps, free mem decrease and cached mem increase but
after exit from app, mem still hold as cached
mem and not all mem return as free mem.

And  if there is request from kernel space ( from some driver module ,
kmalloc or kalloc ), it seems its not going through and request failing.


Any idea ? is that generic behavior of android ?

-- 
Thanks

--



android: memory for kernel and apps

by Uat H1 » Mon, 15 Mar 2010 20:59:00 GMT


 It's usual on Linux (where Android comes from), while the system has
free memory it caches every access to storage devices to improve later
access to same data.
When the system needs memory for a process the cached memory is
immediately available if needed, the system will discard or save on
disk some of the cached content and use the new free memory for the
demanding process.
You nearly may consider cached memory as free memory.




-- 


Sponsored Links


android: memory for kernel and apps

by Dianne Hackborn » Tue, 16 Mar 2010 02:16:22 GMT


 On top of that, Android also keeps live processes around as a cache, even if
they are not currently doing anything.  These will be killed by the Android
Patented Viking Killer as part of the cache eviction when more memory is
needed.





> website: 



Other Threads

1. Customized AnalogClock widget doesn't survive screen orientation change

Hello,

I've created a simple analog clock widget for SonyEricsson X10 mini
pro. It just changes the style of standard android AnalogClock widget.
Widget works fine until screen orientation changes when I slide the
physical keyboard. At this moment I recieve the following error:

W/AppWidgetHostView( 1305): updateAppWidget couldn't find any view,
using error
view
W/AppWidgetHostView( 1305): android.view.InflateException: Binary XML
file line
#12: Error inflating class android.widget.AnalogClock
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.createView(Layout
Inflater.java:513)
W/AppWidgetHostView( 1305):     at
com.android.internal.policy.impl.PhoneLayoutI
nflater.onCreateView(PhoneLayoutInflater.java:56)
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.createViewFromTag
(LayoutInflater.java:563)
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.rInflate(LayoutIn
flater.java:618)
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.inflate(LayoutInf
later.java:407)
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.inflate(LayoutInf
later.java:320)
W/AppWidgetHostView( 1305):     at
android.widget.RemoteViews.apply(RemoteViews.
java:900)
W/AppWidgetHostView( 1305):     at
android.appwidget.AppWidgetHostView.updateApp
Widget(AppWidgetHostView.java:208)
W/AppWidgetHostView( 1305):     at
android.appwidget.AppWidgetHost.createView(Ap
pWidgetHost.java:217)
W/AppWidgetHostView( 1305):     at
com.sonyericsson.homescreen.HomeScreen.create
AppWidget(HomeScreen.java:1026)
W/AppWidgetHostView( 1305):     at
com.sonyericsson.homescreen.HomeScreen.access
$3100(HomeScreen.java:105)
W/AppWidgetHostView( 1305):     at
com.sonyericsson.homescreen.HomeScreen$Widget
LoaderThread.run(HomeScreen.java:2423)
W/AppWidgetHostView( 1305): Caused by:
java.lang.reflect.InvocationTargetExcepti
on
W/AppWidgetHostView( 1305):     at
android.widget.AnalogClock.<init>(AnalogClock
.java:62)
W/AppWidgetHostView( 1305):     at
java.lang.reflect.Constructor.constructNative
(Native Method)
W/AppWidgetHostView( 1305):     at
java.lang.reflect.Constructor.newInstance(Con
structor.java:446)
W/AppWidgetHostView( 1305):     at
android.view.LayoutInflater.createView(Layout
Inflater.java:500)
W/AppWidgetHostView( 1305):     ... 11 more
W/AppWidgetHostView( 1305): Caused by: java.lang.RuntimeException:
Can't create
handler inside thread that has not called Looper.prepare()
W/AppWidgetHostView( 1305):     at
android.os.Handler.<init>(Handler.java:121)
W/AppWidgetHostView( 1305):     at
android.widget.AnalogClock.<init>(AnalogClock
.java:52)
W/AppWidgetHostView( 1305):     ... 15 more

My code is here:

public class ClockWidget extends AppWidgetProvider
{
    public void onReceive(Context context, Intent intent)
    {
        String action = intent.getAction();
        if (AppWidgetManager.ACTION_APPWIDGET_UPDATE.equals(action))
        {
            RemoteViews views = new
RemoteViews(context.getPackageName(), R.layout.widget);
AppWidgetManager.getInstance(context).updateAppWidget(intent.getIntArrayExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS),
views);
        }
    }
}

And layout file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
                                android:id="@+id/Widget"
                                android:layout_width="fill_parent"
                                android:layout_height="fill_parent"
                                android:gravity="center">
        <AnalogClock android:saveEnabled="true" android:id="@+id/AnalogClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:dial="@drawable/
widgetdial" android:hand_hour="@drawable/widgethour"
android:hand_minute="@drawable/widgetminute"/>
</RelativeLayout>

Could you please advise what can cause such problem.

Thanks,
Alexander

-- 

2. Video not getting played from URL, same video is getting played locally

Hi All,

I am trying to play video on my application. The video files are
hosted in my server and I am using the VideoView to play them.

The problem I am facing is that no video is shown in the screen. The
logcat only shows the amount of buffering but it does not shows any
type of codec that has been used to pay the video

Surprisingly if i transfer the same file to my sdcard and use the
default player, it plays fine saying that MPEG4 codes is been used.

What may be the problem.

Kindly Help

Here is my code for the reference-

setContentView(R.layout.videoplayer);
Bundle bundle = getIntent().getExtras();

VideoView videoView = (VideoView) findViewById(R.id.VideoView);
videoView.setOnPreparedListener(this);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);

Uri video = Uri.parse("http://newshunt.biz/Test/video/Test/
outputfile.mp4");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();

-- 

3. Capture image with Intent

4. Why doesn't Cursor expose useful and public features of SQLiteCursor?

5. [WTA]Google Calendar dan default notification

6. Tanya...

7. HttpURLConnection gives UnknownHostException