DDMS does not report memory that is allocated on your behalf on the
native side. You are using too much memory, hence the
OutOfMemoryError.

On Wed, Aug 4, 2010 at 11:54 PM, Alex Xin <[email protected]> wrote:
> Hi,
> I'm using DDMS to track my app's allocation event and heap memory size. I
> found that my app only use 2M-4M heap memory, so it's impossible to have out
> of memory issue.
> thanks & BRs
> Alex
>
> On Thu, Aug 5, 2010 at 2:17 AM, Romain Guy <[email protected]> wrote:
>>
>> The amount of RAM your phone has doesn't matter. One a WVGA device,
>> the maximum amount of memory you can use in your app is 24 MB. You are
>> using too much memory (or leaking memory) in yoru app.
>>
>> On Wed, Aug 4, 2010 at 11:14 AM, Alex Xin <[email protected]> wrote:
>> > Hi, All
>> > I'm now facing a very strange out of memory issue on Nexus One.
>> > I have a user leaves a comment in market said that my app always got
>> > force
>> > closed on his Nexus One, then I try to contact that user and ask for the
>> > logcat. Here's the logcat:
>> >
>> > E/AndroidRuntime( 4016): FATAL EXCEPTION: main
>> > E/AndroidRuntime( 4016): java.lang.OutOfMemoryError: bitmap size exceeds
>> > VM
>> > budget
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.Bitmap.nativeCreate(Native
>> > Method)
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.Bitmap.createBitmap(Bitmap.java:468)
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.Bitmap.createBitmap(Bitmap.java:435)
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
>> > E/AndroidRuntime( 4016):      at
>> > android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
>> > E/AndroidRuntime( 4016):      at
>> >
>> > android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
>> > E/AndroidRuntime( 4016):      at
>> >
>> > android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
>> > E/AndroidRuntime( 4016):      at
>> > android.content.res.Resources.loadDrawable(Resources.java:1767)
>> > E/AndroidRuntime( 4016):      at
>> > android.content.res.Resources.getDrawable(Resources.java:588)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.ImageView.resolveUri(ImageView.java:489)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.ImageView.setImageResource(ImageView.java:274)
>> > E/AndroidRuntime( 4016):      at
>> > xcxin.filexpert.FileAdapter.getView(FileAdapter.java:273)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.AbsListView.obtainView(AbsListView.java:1294)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.GridView.makeAndAddView(GridView.java:1219)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.GridView.makeRow(GridView.java:265)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.GridView.fillDown(GridView.java:218)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.GridView.fillGap(GridView.java:185)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.AbsListView.trackMotionScroll(AbsListView.java:2944)
>> > E/AndroidRuntime( 4016):      at
>> > android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2485)
>> > E/AndroidRuntime( 4016):      at
>> > android.os.Handler.handleCallback(Handler.java:587)
>> > E/AndroidRuntime( 4016):      at
>> > android.os.Handler.dispatchMessage(Handler.java:92)
>> > E/AndroidRuntime( 4016):      at android.os.Looper.loop(Looper.java:123)
>> > E/AndroidRuntime( 4016):      at
>> > android.app.ActivityThread.main(ActivityThread.java:4627)
>> > E/AndroidRuntime( 4016):      at
>> > java.lang.reflect.Method.invokeNative(Native
>> > Method)
>> > E/AndroidRuntime( 4016):      at
>> > java.lang.reflect.Method.invoke(Method.java:521)
>> > E/AndroidRuntime( 4016):      at
>> >
>> > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
>> > E/AndroidRuntime( 4016):      at
>> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
>> > E/AndroidRuntime( 4016):      at dalvik.system.NativeStart.main(Native
>> > Method)
>> >
>> > As we all could see, we have an out of memory issue here, here's the
>> > code
>> > that cause this exception:
>> >
>> > vh.iv.setImageResource(R.drawable.zip);
>> >
>> > I try to render a item with image.
>> >
>> > The problem is that this app works great on other phones, include HTC
>> > Dream,
>> > which only has 192MB of RAM, but Nexus One has 512MB of RAM. So if it's
>> > really the memory leak issue, why it's not in Dream?
>> >
>> > Does anyone has the same issue? How do you solve that?
>> >
>> > Thank you & BRs,
>> >
>> > Alex
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to [email protected]
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > For more options, visit this group at
>> > http://groups.google.com/group/android-developers?hl=en
>>
>>
>>
>> --
>> Romain Guy
>> Android framework engineer
>> [email protected]
>>
>> 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 [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Romain Guy
Android framework engineer
[email protected]

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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to