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

outofmemory error any way to release memory

More
10 years 10 months ago #9034 by [email protected]
hi,

we are implementing PDFLayoutView with viewpager to open list of pdf file. we create our own thumbnail so that user can switch between pdf file easily.

out of memory occur when we are keep selecting different pdf file from the thumbnail. clicking the thumbnail we will call viewpager.setCurrentItem(index)

any way to release memory so that out of memory error can avoid in viewpager fragment
More
10 years 10 months ago #9037 by support
It seems you're taking your files opened all at the same time.
That behavior is really memory consuming.
Your document lifecycle should be tight to the actual Page from ViewPager: destroy documents as soon as a Page is destroyed.
More
10 years 10 months ago #9039 by [email protected]
i below is my onDestroy, onDestroyView and onDetach of my fragment class:
Code:
@Override public void onDestroyView() { super.onDestroyView(); onDestroy(); } @Override public void onDestroy() { super.onDestroy(); Log.d("DD", "onDestroy onDestroy onDestroy onDestroy"); try { if (m_reader != null) { m_reader.PDFClose(); } m_reader = null; if (m_doc != null) { m_doc.Close(); } m_doc = null; // if (mContentView != null) // mContentView.removeAllViews(); // mContentView = null; /* * if (m_layout != null) m_layout.removeAllViews(); m_layout = null; */ Global.RemoveTmp(); // super.onDestroy(); // System.gc(); } catch (Exception e) { e.printStackTrace(); } } @Override public void onDetach() { super.onDetach(); onDestroy(); }

i had call
Code:
m_reader.PDFClose()
and
Code:
m_doc.Close();
in onDestroy. issue still persist.

FYI, this issue happen frequently after i implement
Code:
PDFAESStream
encryption
Time to create page: 0.389 seconds
Powered by Kunena Forum