RadaeePDF.com :: Topic: How to avoid OutOfMemoryError (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: How to avoid OutOfMemoryError

How to avoid OutOfMemoryError 2 years 10 months ago #7175

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!
The administrator has disabled public write access.

How to avoid OutOfMemoryError 2 years 10 months ago #7191

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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());
The administrator has disabled public write access.

How to avoid OutOfMemoryError 2 years 10 months ago #7193

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?
Last Edit: 2 years 10 months ago by jota503.
The administrator has disabled public write access.

How to avoid OutOfMemoryError 2 years 10 months ago #7197

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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.
The administrator has disabled public write access.
Powered by Kunena Forum