- Posts: 19
- Thank you received: 0
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
- [email protected]
- Topic Author
- Offline
- New Member
-
Less
More
10 years 10 months ago #9034
by [email protected]
outofmemory error any way to release memory was created 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
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
10 years 10 months ago #9037
by support
Replied by support on topic outofmemory error any way to release memory
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.
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.
- [email protected]
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 19
- Thank you received: 0
10 years 10 months ago #9039
by [email protected]
Replied by [email protected] on topic outofmemory error any way to release memory
i below is my onDestroy, onDestroyView and onDetach of my fragment class:
i had call
and
in onDestroy. issue still persist.
FYI, this issue happen frequently after i implement
encryption
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()
Code:
m_doc.Close();
FYI, this issue happen frequently after i implement
Code:
PDFAESStream
Time to create page: 0.389 seconds