Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

outofmemory error any way to release memory 8 years 10 months ago #9034

  • abhilash_vijayakumar@yahoo.com
  • abhilash_vijayakumar@yahoo.com's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
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

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

outofmemory error any way to release memory 8 years 10 months ago #9037

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 692
  • Thank you received: 59
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.

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

outofmemory error any way to release memory 8 years 10 months ago #9039

  • abhilash_vijayakumar@yahoo.com
  • abhilash_vijayakumar@yahoo.com's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 19
  • Thank you received: 0
i below is my onDestroy, onDestroyView and onDetach of my fragment class:
@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
m_reader.PDFClose()
and
m_doc.Close();
in onDestroy. issue still persist.

FYI, this issue happen frequently after i implement
PDFAESStream
encryption

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

  • Page:
  • 1
Powered by Kunena Forum