Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

out of memory #21

Closed
parkwh opened this Issue · 2 comments

3 participants

@parkwh

Sometimes flip when a problem occurs.

Can solve it?

Thanks~

12-11 16:09:47.751: D/OpenAphid(14478): create bitmap 720x1142

FATAL EXCEPTION: main
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
at com.aphidmobile.flip.GrabIt.takeScreenshot(GrabIt.java:33)
at com.aphidmobile.flip.ViewDualCards.setView(ViewDualCards.java:75)
at com.aphidmobile.flip.FlipCards.reloadTexture(FlipCards.java:106)
at com.aphidmobile.flip.FlipRenderer.updateTexture(FlipRenderer.java:135)
at com.aphidmobile.flip.FlipViewController.onLayout(FlipViewController.java:327)
at android.view.View.layout(View.java:14063)
at android.view.ViewGroup.layout(ViewGroup.java:4605)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14063)
at android.view.ViewGroup.layout(ViewGroup.java:4605)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1655)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1513)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1426)
at android.view.View.layout(View.java:14063)
at android.view.ViewGroup.layout(ViewGroup.java:4605)
at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
at android.view.View.layout(View.java:14063)
at android.view.ViewGroup.layout(ViewGroup.java:4605)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1998)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1819)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1116)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4533)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4943)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1036)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:803)
at dalvik.system.NativeStart.main(Native Method)

@openaphid
Owner

FlipView needs to capture screenshots of the current page and the next page for the animation while flipping.

The screenshots are kept as bitmaps in the main thread for a while, until they're binded to OpenGL textures in GL thread.

OOM errors are expected to happen when there is not enough memory left in your app process for the bitmaps.

I'm considering about adding a fail-safe strategy in a future version, which turns to use a placeholder texture when OOM error throws.

@openaphid openaphid was assigned
@openaphid openaphid referenced this issue from a commit
@openaphid 1. Rewrite the core control logic
2. Fix several issues of loading views from adapter
3. Performance improvement
#34, #29, #28, #21
c187a82
@openaphid openaphid closed this
@manhhoangxuan

I still encounter this problem.
I am using htc one x for testing (720 * 1280)
when I flip some page, sometimes my app is crash with logcat is like this issus log (out of memory because at com.aphidmobile.flip.GrabIt.takeScreenshot(GrabIt.java:33))

I have newest lib version

Please help me,
Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.