Bug #228
[ContactList] OutOfMemoryError
Description
How to reproduce it:
Launch your contact list activity
Change the screen orientation a lot of time (something like 20 times... it depends of your memory usage on your device)
Interesting links:
[[http://osdir.com/ml/AndroidDevelopers/2009-05/msg02849.html]]
[[http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue]]
Traces:
.
.
.
12-15 23:26:07.109: DEBUG/StatusBar(563): updateResources
12-15 23:26:07.229: DEBUG/BeemService(701): ONUNBIND
12-15 23:26:08.208: INFO/WindowManager(563): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1/2 nav=3 orien=2 }
12-15 23:26:08.285: DEBUG/dalvikvm(563): GC freed 675 objects / 31104 bytes in 83ms
12-15 23:26:08.297: INFO/WindowManager(563): onOrientationChanged, rotation changed to 0
12-15 23:26:08.297: INFO/WindowManager(563): Setting rotation to 0, animFlags=0
12-15 23:26:08.381: INFO/WindowManager(563): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1/2 nav=3 orien=1 }
12-15 23:26:08.575: DEBUG/StatusBar(563): updateResources
12-15 23:26:08.644: DEBUG/StatusBar(563): updateResources
12-15 23:26:08.909: DEBUG/BeemService(701): ONUNBIND
12-15 23:26:09.710: DEBUG/dalvikvm(563): GC freed 1049 objects / 48448 bytes in 82ms
12-15 23:26:09.710: INFO/WindowManager(563): onOrientationChanged, rotation changed to 1
12-15 23:26:09.710: INFO/WindowManager(563): Setting rotation to 1, animFlags=1
12-15 23:26:09.735: INFO/WindowManager(563): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1/1 nav=3 orien=2 }
12-15 23:26:09.930: DEBUG/StatusBar(563): updateResources
12-15 23:26:10.082: DEBUG/BeemService(701): ONUNBIND
12-15 23:26:12.325: DEBUG/dalvikvm(563): GC freed 732 objects / 33400 bytes in 95ms
12-15 23:26:15.303: INFO/WindowManager(563): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1/2 nav=3 orien=2 }
12-15 23:26:15.375: INFO/WindowManager(563): onOrientationChanged, rotation changed to 0
12-15 23:26:15.423: INFO/WindowManager(563): Setting rotation to 0, animFlags=0
12-15 23:26:15.438: INFO/WindowManager(563): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=3 key=2/1/2 nav=3 orien=1 }
12-15 23:26:15.526: ERROR/dalvikvm-heap(701): 307200-byte external allocation too large for this process.
12-15 23:26:15.578: ERROR/(701): VM won't let us allocate 307200 bytes
12-15 23:26:15.578: DEBUG/AndroidRuntime(701): Shutting down VM
12-15 23:26:15.589: DEBUG/StatusBar(563): updateResources
12-15 23:26:15.589: WARN/dalvikvm(701): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
12-15 23:26:15.589: ERROR/AndroidRuntime(701): Uncaught handler: thread main exiting due to uncaught exception
12-15 23:26:15.676: ERROR/AndroidRuntime(701): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:363)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:212)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:663)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.content.res.Resources.loadDrawable(Resources.java:1637)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.content.res.Resources.getDrawable(Resources.java:535)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2169)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:2203)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:305)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.Activity.setContentView(Activity.java:1626)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.beem.project.beem.ui.ContactList.onCreate(ContactList.java:139)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3278)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread.access$1900(ActivityThread.java:112)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.os.Handler.dispatchMessage(Handler.java:99)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.os.Looper.loop(Looper.java:123)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at android.app.ActivityThread.main(ActivityThread.java:3948)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at java.lang.reflect.Method.invokeNative(Native Method)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at java.lang.reflect.Method.invoke(Method.java:521)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
12-15 23:26:15.676: ERROR/AndroidRuntime(701): at dalvik.system.NativeStart.main(Native Method)
12-15 23:26:15.699: DEBUG/StatusBar(563): updateResources
.
.
.
Updated by Frédéric Barthéléry about 15 years ago
- Status changed from New to Assigned
- Assignee set to Frédéric Barthéléry
- Priority changed from Urgent to Normal
Je m'en charge j'ai presque fixer la fuite
Updated by Frédéric Barthéléry about 15 years ago
- Status changed from Assigned to Resolved
- % Done changed from 0 to 100
Applied in changeset r582.
Updated by Frédéric Barthéléry about 15 years ago
A propos¶
When you stess your activity by changing the screen orientation many times and very quickly, the following error is almost inevitable :
java.lang.OutOfMemoryError: bitmap size exceeds VM budget
This error happens even with the simpliest activity :
public class Demo extends Activity {
}
So if you want to report OutOfMemoryError due to leaks in the code, please test it by adding a finalize method.
public class Demo extends Activity {
@Override
protected void finalize() {
Log.v("DEMO", "Finalize is call. The garbage collector free our activity memory");
}
}
If the finalize method is never called, we have a leak so report it.
NB: Maybe we should report this simple bug to upstream.