How to avoid OutOfMemoryError - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: How to avoid OutOfMemoryError

How to avoid OutOfMemoryError 4 years 2 months ago #7175

  • douglasmedia
  • douglasmedia's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 0
Hello,

I am developing an android app which uses the pdf sdk (latest version) in a viewpager. Before I open the document, I called vClose() to avoid memory leaks (I got an OutOfMemoryError without that).
    public void open(Document doc) {
        m_pdv = new PDFCustomView(getContext());
        m_pdv.vClose();

        if (zoomListener != null) {
            m_pdv.setZoomListener(zoomListener);
        }
        m_pdv.vOpen(doc, 4, 0xFFCCCCCC, this);
        m_pdv.vResize(getWidth(), getHeight());
        invalidate();
    }

But now, I sometimes got another error which seems to be deeper in the library:

09-16 10:36:53.593 17291-17291/de.***.meinort W/Adreno-GSL﹕ <sharedmem_gpumem_alloc_id:1489>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
09-16 10:36:53.593 17291-17291/de.***.meinort E/Adreno-GSL﹕ <ioctl_kgsl_sharedmem_alloc:1590>: ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)
09-16 10:36:53.593 17291-18889/de.***.meinort A/libc﹕ bionic/libstdc++/src/pure_virtual.cpp:6: void __cxa_pure_virtual(): assertion "!"Pure virtual function called. Are you calling virtual methods from a destructor?"" failed
09-16 10:36:53.603 17291-18889/de.***.meinort A/libc﹕ Fatal signal 6 (SIGABRT) at 0x0000438b (code=-6), thread 18889 (Thread-16118)


How can I avoid this crash?

Thanks for your help!

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

How to avoid OutOfMemoryError 4 years 1 month ago #7191

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
what mean of:
m_pdv = new PDFCustomView(getContext());
m_pdv.vClose();
???

as i tink, it should be:
if( m_pdv != null ) m_pdv.vClose();
m_pdv = new PDFCustomView(getContext());

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

How to avoid OutOfMemoryError 4 years 1 month ago #7193

  • douglasmedia
  • douglasmedia's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 7
  • Thank you received: 0
Thanks for your help! I've tried this but it did not solve my problem. I still get the same error:

09-19 10:25:12.336 16618-16618/de.geigerverlag.meinort W/Adreno-GSL﹕ <sharedmem_gpumem_alloc_id:1489>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
09-19 10:25:12.336 16618-16618/de.geigerverlag.meinort E/Adreno-GSL﹕ <ioctl_kgsl_sharedmem_alloc:1590>: ioctl_kgsl_sharedmem_alloc: FATAL ERROR : (null)
09-19 10:25:12.346 16618-17519/de.geigerverlag.meinort A/libc﹕ bionic/libstdc++/src/pure_virtual.cpp:6: void __cxa_pure_virtual(): assertion "!"Pure virtual function called. Are you calling virtual methods from a destructor?"" failed
09-19 10:25:12.356 16618-17519/de.geigerverlag.meinort A/libc﹕ Fatal signal 6 (SIGABRT) at 0x000040ea (code=-6), thread 17519 (Thread-27888)


// Edit:
PS: Now, the OOM occurs when I try to resize the view with m_pdv.vResize(getWidth(), getHeight());

How to solve this issue?

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

Last edit: by jota503.

How to avoid OutOfMemoryError 4 years 1 month ago #7197

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 846
  • Karma: 43
  • Thank you received: 12
are width and height of view are very large?

or any large bitmaps out of PDFView?
using Bitmap.recycle() to free memory, if you has many Bitmap objects or a large Bitmap object allocated.

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

  • Page:
  • 1
Powered by Kunena Forum