Too many Out of Memory exceptions - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Too many Out of Memory exceptions

Too many Out of Memory exceptions 4 years 2 months ago #9243

  • dashti
  • dashti's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0
We received too many out of memory exceptions with PDFView, so we updated our application to use the new PDFLayout class. However, we still receive such exceptions as I have copied below
java.lang.OutOfMemoryError
	at android.graphics.Bitmap.nativeCreate(Native Method)
	at android.graphics.Bitmap.createBitmap(Bitmap.java:669)
	at android.graphics.Bitmap.createBitmap(Bitmap.java:649)
	at com.radaee.view.PDFLayout.vResize(SourceFile:122)
	at com.radaee.reader.PDFLayoutView.onSizeChanged(SourceFile:333)
	at android.view.View.setFrame(View.java:14002)
	at android.view.View.layout(View.java:13914)
	at android.widget.RelativeLayout.onLayout(RelativeLayout.java:948)
	at android.view.View.layout(View.java:13916)
	at android.view.ViewGroup.layout(ViewGroup.java:4424)
	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
	at android.view.View.layout(View.java:13916)
	at android.view.ViewGroup.layout(ViewGroup.java:4424)
	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:13916)
	at android.view.ViewGroup.layout(ViewGroup.java:4424)
	at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
	at android.view.View.layout(View.java:13916)
	at android.view.ViewGroup.layout(ViewGroup.java:4424)
	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2029)
	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1850)
	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1143)
	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4667)
	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:4960)
	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:1038)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
	at dalvik.system.NativeStart.main(Native Method)

Is there any way to fix this problem or this is a weakness of Radaee?

Please Log in or Create an account to join the conversation.

Too many Out of Memory exceptions 4 years 2 months ago #9245

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Karma: 18
  • Thank you received: 65
Hi,
can you please give us more details about that issue..
Can you reproduce this out of memory with all the pdfs? Can you please send us one to test it?
What version of the library are you using? Have you tried with the last beta version ?
Can you please give us your Global.java class?

Please Log in or Create an account to join the conversation.

Last edit: by Davide.

Too many Out of Memory exceptions 4 years 2 months ago #9246

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 886
  • Karma: 43
  • Thank you received: 16
it seems, u are using lots Bitmap object out of PDFView class and PDFLayout class
a bitmap same to View size is needed for 1 PDFView or PDFLayout.
mostly, costs about 1920 * 1080 * 4 bytes.

others: not invoked PDFReader.PDFClose() when close View or reopen a View,
or not invoked PDFLayoutView.PDFClose().

Please Log in or Create an account to join the conversation.

Last edit: by radaee.

Too many Out of Memory exceptions 4 years 2 months ago #9248

  • dashti
  • dashti's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 10
  • Thank you received: 0
Actually, I can't give you a specific file which has this problem, since we use a crash report system which tells us how many crashes occur in our app and I don't know which crash has occurred with opening of which file. But an interesting point is that this kind of exception mostly occurs in Samsung devices.
I am using SDK 3.4, but I have not tested the beta version of 3.5 since that is under android studio.
I have not modified Global.java at all. That's the same file in SDK 3.4, I just call Global.init() to set my license info.
FYI, this is a second trace of exception I receive from Radaee.
java.lang.OutOfMemoryError
	at android.graphics.Bitmap.nativeCreate(Native Method)
	at android.graphics.Bitmap.createBitmap(Bitmap.java:726)
	at android.graphics.Bitmap.createBitmap(Bitmap.java:703)
	at android.graphics.Bitmap.createBitmap(Bitmap.java:670)
	at com.radaee.view.VPage.vZoomStart(SourceFile:369)
	at com.radaee.view.PDFLayout.vZoomStart(SourceFile:289)
	at com.radaee.reader.PDFLayoutView.onTouchNone(SourceFile:615)
	at com.radaee.reader.PDFLayoutView.onTouchEvent(SourceFile:999)
	at ir.mservices.mybook.reader.pdf.layout.MyPDFLayoutView.onTouchEvent(SourceFile:109)
	at android.view.View.dispatchTouchEvent(View.java:7822)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
	at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
	at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2326)
	at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1612)
	at android.app.Activity.dispatchTouchEvent(Activity.java:2494)
	at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2274)
	at android.view.View.dispatchPointerEvent(View.java:8030)
	at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4574)
	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4462)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4056)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4113)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4082)
	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4167)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4090)
	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4224)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4056)
	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4113)
	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4082)
	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4090)
	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4056)
	at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6224)
	at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6154)
	at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6125)
	at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6304)
	at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
	at android.os.MessageQueue.nativePollOnce(Native Method)
	at android.os.MessageQueue.next(MessageQueue.java:132)
	at android.os.Looper.loop(Looper.java:138)
	at android.app.ActivityThread.main(ActivityThread.java:5493)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:525)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1225)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1041)
	at dalvik.system.NativeStart.main(Native Method)

Please Log in or Create an account to join the conversation.

Last edit: by dashti.

Too many Out of Memory exceptions 4 years 2 months ago #9253

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 886
  • Karma: 43
  • Thank you received: 16
it can upgrade your eclipse project in this way:
copy JNI libs from last beta version in dir "PDFSample/ViewLib/src/main/jniLibs"
copy resources folder from "PDFSample/ViewLib/src/main/res/raw" to your "res" dir, after this u shall has "res/raw"
copy java codes from "PDFSample/ViewLib/src/main/java/com/radaee/pdf"
copy java codes from "PDFSample/ViewLib/src/main/java/com/radaee/view"
copy java codes from "PDFSample/ViewLib/src/main/java/com/radaee/util"
version 3.4 not auto-relase some objects, u shall free allocated memory manually.
for example:
PDFThumbView.thumbClose();
PDFReader,PDFClose();
Document.Close();

while 3.5 beta override "finalize" method, and can auto-release memory allocated by native lib by GC.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum