DDMS has a feature to dump the Java heap. You can then analyze is
using tools like hat, MAT, JProfiler, etc.

On Thu, Dec 10, 2009 at 4:17 PM, Matt Kanninen <mathias...@gmail.com> wrote:
> Got any advice on tools to use to debug the most likely situation
> you've described?  I'm at the point where I've ruled out static
> variables.
>
> I'm working on code that started with Android 1.0, and has had a
> series of developers since.  Good code analysis tools could help
> immensely.  It beats re writing every class.
>
> On Dec 10, 3:47 pm, Romain Guy <romain...@android.com> wrote:
>> If there's an OutOfMemoryError, it's most likely that the app is using
>> too much memory and/or leaking. Filing a bug won't help.
>>
>>
>>
>> On Thu, Dec 10, 2009 at 3:43 PM, Matt Kanninen <mathias...@gmail.com> wrote:
>> > Best of luck.  I recommend you create a very small test application to
>> > reproduce the bug, and submit it to b.android.com.
>>
>> > On Dec 10, 12:52 pm, Mark Hansen <stonedon...@gmail.com> wrote:
>> >> So I want to start an animation when my application starts that always
>> >> visible in the application.  So reading about the AnimationDrawable it
>> >> was stated to use onWindowFocusChanged instead of onCreate() to ensure
>> >> that animation would start properly in the UI thread.
>>
>> >>         @Override
>> >>         public void onWindowFocusChanged(boolean hasFocus) {
>> >>                 super.onWindowFocusChanged(hasFocus);
>>
>> >>                 AnimationDrawable cam;
>> >>                 ImageView iv = 
>> >> (ImageView)findViewById(R.id.ImageViewFuzzAnimation);
>> >>                 iv.setBackgroundResource(R.anim.fuzz_animation);
>> >>                 cam = (AnimationDrawable)iv.getBackground();
>> >>                 cam.start();
>>
>> >>         }
>>
>> >> This works fine, but if I leave my application and come back I get a
>> >> out of memory error, below is the log..
>>
>> >> Can anyone help me out on what I may be doing wrong here?
>>
>> >> 12-10 15:52:14.365: ERROR/dalvikvm-heap(3102): 805600-byte external
>> >> allocation too large for this process.
>> >> 12-10 15:52:14.373: ERROR/(3102): VM won't let us allocate 805600
>> >> bytes
>> >> 12-10 15:52:14.373: DEBUG/skia(3102): --- decoder->decode returned
>> >> false
>> >> 12-10 15:52:16.490: DEBUG/dalvikvm(1570): GC freed 797 objects / 43592
>> >> bytes in 94ms
>> >> 12-10 15:52:20.147: DEBUG/AndroidRuntime(3102): Shutting down VM
>>
>> >> 12-10 15:52:20.147: ERROR/AndroidRuntime(3102): Uncaught handler:
>> >> thread main exiting due to uncaught exception
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):
>> >> java.lang.OutOfMemoryError: bitmap size exceeds VM budget
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:
>> >> 323)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.drawable.Drawable.createFromResourceStream
>> >> (Drawable.java:697)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.content.res.Resources.loadDrawable(Resources.java:1705)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.content.res.Resources.getDrawable(Resources.java:580)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.drawable.AnimationDrawable.inflate
>> >> (AnimationDrawable.java:265)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:
>> >> 788)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.content.res.Resources.loadDrawable(Resources.java:1690)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.content.res.Resources.getDrawable(Resources.java:580)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.view.View.setBackgroundResource(View.java:7187)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> com.stonedonkey.santatracker.ActivityGUI.onWindowFocusChanged
>> >> (ActivityGUI.java:170)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> com.android.internal.policy.impl.PhoneWindow
>> >> $DecorView.onWindowFocusChanged(PhoneWindow.java:1969)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.view.View.dispatchWindowFocusChanged(View.java:3731)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:656)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.view.ViewRoot.handleMessage(ViewRoot.java:1819)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.os.Handler.dispatchMessage(Handler.java:99)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.os.Looper.loop(Looper.java:123)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> android.app.ActivityThread.main(ActivityThread.java:4338)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> java.lang.reflect.Method.invokeNative(Native Method)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> java.lang.reflect.Method.invoke(Method.java:521)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
>> >> (ZygoteInit.java:860)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
>> >> 12-10 15:52:20.232: ERROR/AndroidRuntime(3102):     at
>> >> dalvik.system.NativeStart.main(Native Method)
>>
>> > --
>> > 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
>>
>> --
>> 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
>



-- 
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