Bug 693607 - MupdfActivity crash when rotating the device
Summary: MupdfActivity crash when rotating the device
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: 1.1
Hardware: Android Phone Android
: P4 normal
Assignee: Matt Holgate
URL:
Keywords:
: 695301 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-02-01 03:04 UTC by Rodrigo Amaro
Modified: 2014-07-15 08:08 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Amaro 2013-02-01 03:04:26 UTC
When Im seeing a document, if I rotate the device several times, the document viewer activity closes without message. 
This happend with de apk in GooglePlay
Comment 1 Robin Watts 2013-02-27 18:41:55 UTC
On what device please? I cannot reproduce this here.

If you are setup for android development/debugging, could you try to trigger this while connected via USB with "adb logcat" running please? Then hopefully we'd see some useful information in the log.

Thanks.
Comment 2 LHTuan 2014-06-10 18:14:04 UTC
I also have same problem. I test on sony xperia x10i, RAM 256MB.
This is logcat.
06-10 11:17:18.671: I/dalvikvm-heap(18133): Clamp target GC heap from 32.464MB to 32.000MB
06-10 11:17:18.671: D/dalvikvm(18133): GC_FOR_MALLOC freed 1205K, 54% free 3666K/7879K, external 24943K/26991K, paused 32ms
06-10 11:17:18.681: E/AndroidRuntime(18133): FATAL EXCEPTION: main
06-10 11:17:18.681: E/AndroidRuntime(18133): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.graphics.Bitmap.nativeCreate(Native Method)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.artifex.mupdfdemo.PageView.<init>(PageView.java:145)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.artifex.mupdfdemo.MuPDFPageView.<init>(MuPDFPageView.java:113)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.artifex.mupdfdemo.MuPDFPageAdapter.getView(MuPDFPageAdapter.java:43)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.artifex.mupdfdemo.ReaderView.getOrCreateChild(ReaderView.java:697)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.artifex.mupdfdemo.ReaderView.onLayout(ReaderView.java:606)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:690)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1263)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1137)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.LinearLayout.onLayout(LinearLayout.java:1051)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.View.layout(View.java:7301)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.ViewRoot.performTraversals(ViewRoot.java:1160)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.view.ViewRoot.handleMessage(ViewRoot.java:1880)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.os.Looper.loop(Looper.java:123)
06-10 11:17:18.681: E/AndroidRuntime(18133): at android.app.ActivityThread.main(ActivityThread.java:3701)
06-10 11:17:18.681: E/AndroidRuntime(18133): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 11:17:18.681: E/AndroidRuntime(18133): at java.lang.reflect.Method.invoke(Method.java:507)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
06-10 11:17:18.681: E/AndroidRuntime(18133): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
06-10 11:17:18.681: E/AndroidRuntime(18133): at dalvik.system.NativeStart.main(Native Method)
06-10 11:17:19.421: E/libmupdf(18133): Rendered
Comment 3 Matt Holgate 2014-06-18 07:06:23 UTC
LHTuan/Rodrigo, please could you confirm what version of Android you saw this problem on?

The behaviour of Bitmap objects changed significantly in Android 3.0 (see http://practicingthebetter.blogspot.co.uk/2012/09/bitmap-memory-management-in-android.html).

Prior to 3.0, it wasn't easy to guarantee that bitmaps would be freed immediately after GC, and thus in some situations the app can run out of memory before it has had chance to free up dead bitmaps.

I suspect we can't reproduce this because we're mostly using 4.x devices. I'll try this on a 2.3 device, and see what happens. I'm not sure what the solution should be for this to be honest; we should perhaps just catch the exception and display an out-of-memory warning.
Comment 4 LHTuan 2014-06-18 18:48:20 UTC
I test on
- Android 2.3.3
- Device sony xperia x10i, ram 256MB
Comment 5 Matt Holgate 2014-06-23 02:09:59 UTC
*** Bug 695301 has been marked as a duplicate of this bug. ***
Comment 6 Matt Holgate 2014-06-23 02:11:34 UTC
Thanks for the feedback!

I've marked the bug you opened as a duplicate of this, as it seems to be the same issue.

I've just pushed a change which may help (although I can't confirm, because I can't reproduce the original problem).

Please would you be able to give the latest code a try and see if it resolves the problem?
Comment 7 Matt Holgate 2014-07-15 08:08:10 UTC
Closing this now, please feel free to reopen if you can reproduce the issue with the latest code.