Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

How to avoid OutOfMemoryError

More
IP: 192.168.0.71 11 years 6 months ago #7175 by douglasmedia
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).
Code:
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!
More
IP: 192.168.0.71 11 years 6 months ago #7191 by radaee
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());
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7193 by douglasmedia
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: 11 years 6 months ago by jota503.
More
IP: 192.168.0.71 11 years 5 months ago #7197 by radaee
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.
Time to create page: 0.419 seconds
Powered by Kunena Forum