I too ran into this many times and my images are not on the disk they are
fetched from the network moreover none of my images exceed 5kb so i don't
understand why is it even trying to allocate 74752bytes.

11-26 15:40:34.967: ERROR/dalvikvm-heap(801): 74752-byte external allocation
too large for this process.
11-26 15:40:34.977: ERROR/(801): VM won't let us allocate 74752 bytes
11-26 15:40:35.277: DEBUG/AndroidRuntime(801): Shutting down VM
11-26 15:40:35.277: WARN/dalvikvm(801): threadid=3: thread exiting with
uncaught exception (group=0x40013e28)
11-26 15:40:35.287: ERROR/AndroidRuntime(801): Uncaught handler: thread main
exiting due to uncaught exception
11-26 15:40:35.537: ERROR/AndroidRuntime(801): java.lang.OutOfMemoryError:
bitmap size exceeds VM budget
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.graphics.Bitmap.nativeCreate(Native Method)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.graphics.Bitmap.createBitmap(Bitmap.java:343)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.View.buildDrawingCache(View.java:5219)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.View.getDrawingCache(View.java:5112)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1355)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.widget.AbsListView.dispatchDraw(AbsListView.java:1125)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.widget.ListView.dispatchDraw(ListView.java:2778)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.View.draw(View.java:5422)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1420)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1418)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.View.draw(View.java:5329)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.widget.FrameLayout.draw(FrameLayout.java:324)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1420)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1418)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.drawChild(ViewGroup.java:1418)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1192)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.View.draw(View.java:5329)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.widget.FrameLayout.draw(FrameLayout.java:324)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1701)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewRoot.draw(ViewRoot.java:980)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewRoot.performTraversals(ViewRoot.java:829)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1103)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.os.Handler.dispatchMessage(Handler.java:88)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.os.Looper.loop(Looper.java:123)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
android.app.ActivityThread.main(ActivityThread.java:3742)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
java.lang.reflect.Method.invokeNative(Native Method)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
java.lang.reflect.Method.invoke(Method.java:515)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
11-26 15:40:35.537: ERROR/AndroidRuntime(801):     at
dalvik.system.NativeStart.main(Native Method)
11-26 15:40:35.627: INFO/Process(55): Sending signal. PID: 801 SIG: 3
11-26 15:40:35.627: INFO/dalvikvm(801): threadid=7: reacting to signal 3
11-26 15:40:35.767: INFO/dalvikvm(801): Wrote stack trace to
'/data/anr/traces.txt'

-Aditya

On Tue, Dec 16, 2008 at 7:34 AM, Mark K <mark.ka...@gmail.com> wrote:

>
>
>  Is there a work around for this problem? Something I need to do
> differently perhaps? It seems like garbage collection is not occurring
> between successive bitmap decoding operations. Explicitly calling gc()
> does not seem to help. This is particularly a problem on the G1,
> because there is no way to reduce the camera resolution, all of the
> camera pictures are large. If I loop through a directory of pictures
> taken by the camera and use BitmapFactory.decodeFile(), I will get an
> out of memory error on the 2nd or 3rd iteration. Since I am only
> displaying/decoding one bitmap at a time I would hope that garbage
> collection would free up the memory between operations such that this
> does not occur. Any help would be greatly appreciated. Here's the code
> I use: This code runs a slide show of the images in the camera
> directory, it uses Handler.postDelayed() to render each picture. Is
> there anyway to tweak the code to get rid of the out of memory
> problem.
>
> public boolean slideShow()
>    {
>        String baseDir = "/sdcard/dcim/Camera/";
>        long showTime = 1500;
>
>        File dir = new File(baseDir);
>        File[] pics = dir.listFiles();
>        for ( int i=0; i<pics.length; i++ )
>        {
>                String pic=baseDir+pics[i].getName();
>                handler.postDelayed(new ShowSlide(pic), i*showTime);
>        }
>        return true;
>    }
>
> class ShowSlide extends Thread
>    {
>        String pc="";
>        public ShowSlide(String pc)
>        {
>                this.pc=pc;
>        }
>        public void run()
>        {
>                System.out.println("Showing picture: "+pc.toString());
>                displayPicture(pc);
>        }
>    }
>
> public boolean displayPicture(String filepath)
>    {
>               File file = new File(filepath);
>                BitmapFactory bfac = new BitmapFactory();
>        try
>        {
>                bm = bfac.decodeFile(filepath);// out of memory error occurs
> here!
>                handler.post(new SetImage(iView, bm));
>        }
>        catch(Exception e)
>        {
>           Log.e(TAG,"display picture failed: "+filepath+" "+e.toString
> ());
>           e.printStackTrace();
>           return false;
>        }
>
>        return true;
>    }
>
> class SetImage extends Thread
>    {
>        ImageView vv;
>        Bitmap bb;
>        public SetImage(ImageView vv, Bitmap bb)
>        {
>                this.vv=vv;
>                this.bb=bb;
>        }
>        public void run()
>        {
>                vv.setImageBitmap(bb);
>         }
>    }
>
>
>
> On Dec 15, 2:48 pm, Romain Guy <romain...@google.com> wrote:
> > >  I've run into this exact same problem a number of times myself. Not
> > > sure if its a bug or just a limitation of the jvm, can't seem to
> > > process more than a few large bitmaps without this occuring, this
> > > always seems to occur when decoding bitmaps from file.
> >
> > Neither, you are just using too much memory.
> >
> > --
> > Romain Guy
> > Android framework engineer
> > romain...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them
> >
>

--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to