running out of memory

by shweta kumari » Tue, 03 Feb 2009 02:02:17 GMT


Sponsored Links
 Hi,

I am running a script that runs randomly the browser and music.After 7-8
instances of browser getting opened I see the following error :-

D/AndroidRuntime(  992): Shutting down VM
W/dalvikvm(  992): threadid=3: thread exiting with uncaught exception
(group=0x4000fe68)
E/AndroidRuntime(  992): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime(  992): java.lang.NullPointerException
E/AndroidRuntime(  992):   at
android.app.SearchDialog.jamSuggestionQuery(SearchDialog.java:921)
E/AndroidRuntime(  992):   at
android.app.SearchDialog.onItemSelected(SearchDialog.java:1451)
E/AndroidRuntime(  992):   at
android.widget.AdapterView.fireOnSelected(AdapterView.java:856)
E/AndroidRuntime(  992):   at
android.widget.AdapterView.access$200(AdapterView.java:41)
E/AndroidRuntime(  992):   at
android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:827)
E/AndroidRuntime(  992):   at
android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime(  992):   at
android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(  992):   at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  992):   at
android.app.ActivityThread.main(ActivityThread.java:3790)
E/AndroidRuntime(  992):   at java.lang.reflect.Method.invokeNative(Native
Method)
E/AndroidRuntime(  992):   at
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(  992):   at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:745)
E/AndroidRuntime(  992):   at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:503)
E/AndroidRuntime(  992):   at dalvik.system.NativeStart.main(Native Method)
I/Process (  824): Sending signal. PID: 992 SIG: 3
I/dalvikvm(  992): threadid=7: reacting to signal 3
W/ActivityManager(  824): Force-killing crashed app com.android.browser at
watcher's request
I/Process (  824): Sending signal. PID: 992 SIG: 9
I/ActivityManager(  824): Process com.android.browser (pid 992) has died
I/WindowManager(  824): WIN DEATH: Window{43841140
com.android.browser/com.android.browser.BrowserActivity}
I/WindowManager(  824): WIN DEATH: Window{438589b0
Panel:com.android.browser/com.android.browser.BrowserActivity}
W/WindowManager(  824): No focus window, dropping: KeyEvent{action=1 code=21
repeat=0 meta=0 scancode=0 mFlags=0}
V/ActivityThread(  869): Resuming ActivityRecord{436cfbd0
token=android.os.binderpr...@436cf660{com.android.launcher/com.android.launcher.Launcher}}
with isForward=false
I/ActivityManager(  824): Low Memory: No more background processes.
D/dalvikvm(  891): GC freed 6207 objects / 226360 bytes in 267ms
D/dalvikvm(  824): GC freed 7734 objects / 346640 bytes in 354ms
I/AndroidRuntime(  983): AndroidRuntime onExit calling exit(4973)

Is it possible to open the browser windows consecutively for 10
mins.Secondly why does the background process get killed?

Thanks,
Shweta

--~--~---------~--~----~------------~-------~--~----~



running out of memory

by shweta kumari » Tue, 03 Feb 2009 16:53:05 GMT


 i All,

When i run the browser StartActivityLocked() is called which runs the
activity with some pid. If i open 4 browser windows on UI for each instance
the same process is called (as noted from pid).Does the memory get allocated
for each window? If this process goes
into background state and the foreground process needs memory how the memory
handler works?

Thanks,
Shweta

On Mon, Feb 2, 2009 at 11:21 AM, shweta kumari <shweta.n...@gmail.com>wrote:


--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. how to bring your app to the top of the list

I thought that when you publish an upgrade, your app goes back to the
top of the list (when sorted by date).  Yet it didn't happen with
mine.  At the same time, I see Robo Defense being brought back to the
top all the time.  What am I missing in this picture?
--~--~---------~--~----~------------~-------~--~----~

2. List View not properly updated from AsyncTask

Hi Everyone,

After digging with the APIs I still cannot figure out how the
AsyncTask properly works and why some behavior occur.

I'm trying  to achieve one contact list that can be updated from a
background async task very frequently. There are situations where
invoking UI updates from the background thread just freeze the UI as
you see in example #2. or make the list not to react properly to
finger as a regular contact list. Can anyone give me some hint on how
to achieve the expected behavior?

I added here the activities that form my project (sorry for the lenght
of the post, my idea was to share the complete problem with everyone)

Example 1: Contact list without background task. This code contains
the behavior of a default contact list. This code produce the expected
behavior in responsive for the user but do not update. This activity
shows the ideal response for a contact list.

package com.pp.lists;

import android.app.ListActivity;
import android.content.Intent;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;

public class List1 extends ListActivity implements
View.OnClickListener {

    Button btnBack = null;
    SensorManager sensorManager = null;

    String[] items = { "lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
            "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam",
"vel", "erat", "placerat", "ante", "porttitor",
            "sodales", "pellentesque", "augue", "purus", "lorem",
"ipsum", "dolor", "sit", "amet", "consectetuer",
            "adipiscing", "elit", "morbi", "vel", "ligula", "vitae",
"arcu", "aliquet", "mollis", "etiam", "vel",
            "erat", "placerat", "ante", "porttitor", "sodales",
"pellentesque", "augue", "purus", "lorem", "ipsum",
            "dolor", "sit", "amet", "consectetuer", "adipiscing",
"elit", "morbi", "vel", "ligula", "vitae", "arcu",
            "aliquet", "mollis", "etiam", "vel", "erat", "placerat",
"ante", "porttitor", "sodales", "pellentesque",
            "augue", "purus", "lorem", "ipsum", "dolor", "sit",
"amet", "consectetuer", "adipiscing", "elit", "morbi",
            "vel", "ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
            "porttitor", "sodales", "pellentesque", "augue",
"purus" };

    /** Called when the activity is first created. */
    @Override
    public void onCreate( Bundle savedInstanceState ) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listdemo);
        setListAdapter(new ArrayAdapter<String>(this,
R.layout.listitem, R.id.label, items));

        btnBack = (Button) findViewById(R.id.btnBackFromList);
        btnBack.setOnClickListener(this);
    }

    public void onClick( View arg0 ) {
        if ( btnBack == arg0 ) {
            startActivity(new Intent(this, Main.class));
        }
    }

    public void onResume() {
        System.out.println("List1.onResume!");
        super.onResume();
    }

    public void onPause() {
        System.out.println("List1.onPause!");
        super.onPause();
    }

}

Example 2: This example update the contact list very frequently
properly but without freezing DO NOT allow the user to even scroll.

package com.pp.lists;

import android.app.ListActivity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class List2 extends ListActivity implements
View.OnClickListener {

    Button btnBack = null;
    Handler handler = new Handler();

    String[] items = { "lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
            "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam",
"vel", "erat", "placerat", "ante", "porttitor",
            "sodales", "pellentesque", "augue", "purus", "lorem",
"ipsum", "dolor", "sit", "amet", "consectetuer",
            "adipiscing", "elit", "morbi", "vel", "ligula", "vitae",
"arcu", "aliquet", "mollis", "etiam", "vel",
            "erat", "placerat", "ante", "porttitor", "sodales",
"pellentesque", "augue", "purus", "lorem", "ipsum",
            "dolor", "sit", "amet", "consectetuer", "adipiscing",
"elit", "morbi", "vel", "ligula", "vitae", "arcu",
            "aliquet", "mollis", "etiam", "vel", "erat", "placerat",
"ante", "porttitor", "sodales", "pellentesque",
            "augue", "purus", "lorem", "ipsum", "dolor", "sit",
"amet", "consectetuer", "adipiscing", "elit", "morbi",
            "vel", "ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
            "porttitor", "sodales", "pellentesque", "augue",
"purus" };

    private ArrayAdapter adapter = null;
    private ListView list = null;

    BGSorter task = null;

    EditText txtTest = null;
    public boolean isRunning = true;

    /** Called when the activity is first created. */
    @Override
    public void onCreate( Bundle savedInstanceState ) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listdemo);
        adapter = new ArrayAdapter<String>(this, R.layout.listitem,
R.id.label, items);
        setListAdapter(adapter);

        btnBack = (Button) findViewById(R.id.btnBackFromList);
        btnBack.setOnClickListener(this);

        list = this.getListView();
    }

    public void onClick( View arg0 ) {
        if ( btnBack == arg0 ) {
            startActivity(new Intent(this, Main.class));
        }
    }

    public void onResume() {

        WorkingObject.status = true;

        // Start BG job
        System.out.println("List2.onResume!");

        task = new BGSorter();
        task.execute();

        super.onResume();
    }

    public void onPause() {

        System.out.println("List2.onPause!");
        WorkingObject.status = false;
        task.cancel(true);
        super.onPause();
    }

    class BGSorter extends AsyncTask<Void, String, Void> {

        @Override
        protected void onProgressUpdate( String... args ) {
            try {
                System.out.println("OnProgressUpdate=" +
Thread.currentThread().getName());
                list.invalidateViews();
            } catch ( Exception e ) {
                System.out.println(e.toString());
            }
        }

        @Override
        protected Void doInBackground( Void... arg0 ) {
            System.out.println("DoBackground=" + Thread.currentThread
().getName());

            int random1 = (int) (Math.random() * 10000 % 10); //
items.length);
            int random2 = (int) (Math.random() * 10000 % 10); //
items.length);

            String temp = items[random1];
            items[random1] = items[random2];
            items[random2] = temp;

            publishProgress("random1=" + random1 + " random2=" +
random2);
            return null;
        }

        @Override
        protected void onPostExecute( Void result ) {
            // TODO Auto-generated method stub
            super.onPostExecute(result);

            System.out.println(isCancelled());

            // Launch another copy of the thread
            // if ( isRunning ) {
            if ( WorkingObject.status ) {
                task = new BGSorter();
                task.execute();
            }
        }
    }

    class Holder {
        public int position = 0;
    }

    class UpdateList implements Runnable {
        @Override
        public void run() {
            System.out.println("UpdateList=" + Thread.currentThread
().getName());
            list.invalidateViews();
        }
    }
}

EXAMPLE 3: Allow the user to interact and scroll but not to 100%
accurately. You can see the difference between example 3 and 1 in
result. Here, you will see that after start the scrolling with the
finger,  the list do not respond properly if you try to stop the
scroll as in sample #1. Can anyone give me an idea why?

package com.pp.lists;

import android.app.ListActivity;
import android.content.Intent;
import android.hardware.SensorManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

public class List3 extends ListActivity implements
View.OnClickListener {

    Button btnBack = null;

    Handler handler = new Handler();

    String[] items = { "lorem", "ipsum", "dolor", "sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
            "ligula", "vitae", "arcu", "aliquet", "mollis", "etiam",
"vel", "erat", "placerat", "ante", "porttitor",
            "sodales", "pellentesque", "augue", "purus", "lorem",
"ipsum", "dolor", "sit", "amet", "consectetuer",
            "adipiscing", "elit", "morbi", "vel", "ligula", "vitae",
"arcu", "aliquet", "mollis", "etiam", "vel",
            "erat", "placerat", "ante", "porttitor", "sodales",
"pellentesque", "augue", "purus", "lorem", "ipsum",
            "dolor", "sit", "amet", "consectetuer", "adipiscing",
"elit", "morbi", "vel", "ligula", "vitae", "arcu",
            "aliquet", "mollis", "etiam", "vel", "erat", "placerat",
"ante", "porttitor", "sodales", "pellentesque",
            "augue", "purus", "lorem", "ipsum", "dolor", "sit",
"amet", "consectetuer", "adipiscing", "elit", "morbi",
            "vel", "ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
            "porttitor", "sodales", "pellentesque", "augue",
"purus" };

    private ArrayAdapter adapter = null;
    private ListView list = null;

    BGSorter task = null;

    EditText txtTest = null;
    public boolean isRunning = true;

    /** Called when the activity is first created. */
    @Override
    public void onCreate( Bundle savedInstanceState ) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listdemo);
        adapter = new ArrayAdapter<String>(this, R.layout.listitem,
R.id.label, items);

        setListAdapter(adapter);

        btnBack = (Button) findViewById(R.id.btnBackFromList);
        btnBack.setOnClickListener(this);

        list = this.getListView();
    }

    public void onClick( View arg0 ) {
        if ( btnBack == arg0 ) {
            startActivity(new Intent(this, Main.class));
        }
    }

    public void onResume() {

        // Start BG job
        System.out.println("List2.onResume!");

        task = new BGSorter();
        task.execute();

        super.onResume();
    }

    public void onPause() {

        System.out.println("List2.onPause!");
        task.cancel(true);
        super.onPause();
    }

    class BGSorter extends AsyncTask<Void, String, Void> {

        @Override
        protected void onProgressUpdate( String... args ) {
            try {
                System.out.println("OnProgressUpdate=" +
Thread.currentThread().getName());
                list.invalidateViews();
            } catch ( Exception e ) {
                System.out.println(e.toString());
            }
        }

        @Override
        protected Void doInBackground( Void... arg0 ) {

            while ( !isCancelled() ) {
                System.out.println("DoBackground=" +
Thread.currentThread().getName());

                int random1 = (int) (Math.random() * 10000 % 10); //
items.length);
                int random2 = (int) (Math.random() * 10000 % 10); //
items.length);

                String temp = items[random1];
                items[random1] = items[random2];
                items[random2] = temp;

                publishProgress("random1=" + random1 + " random2=" +
random2);
            }
            return null;
        }

    }

    class Holder {
        public int position = 0;
    }

    class UpdateList implements Runnable {
        @Override
        public void run() {
            System.out.println("UpdateList=" + Thread.currentThread
().getName());
            adapter.notifyDataSetChanged();
        }
    }
}

Thanks for the time. I'will be more than glad to receive your
feedback.
Pablo
--~--~---------~--~----~------------~-------~--~----~

3. Another question MapView

4. Android on PSP?

5. oauth_callback is not calling the activity

6. how does omx component comes to know about the number of channels and sampling rate of the audio clip

7. How to build qwerty.kcm.bin file