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

TOPIC:

Warning: will cause memory leaks 5 years 6 months ago #14138

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
I'm creating a new PDFLayoutView, and a new Document, then doing Document.Open() and PDFLayoutView.PDFOpen().

Then when I want to view a second document, I'm doing PDFLayoutView.PDFClose() and Document.Close(), and creating a new Document (but reusing the PDFLayoutView).

I just noticed these warnings in my console:

"E/Bad Coding: Document object closed, but Page object not closed, will cause memory leaks."

Do I need to do something differently in my code? I see that the Page object has a Close() method, and I can get pages of the Document from the GetPage(n) method. But this seems like something that should be taken care of by the Document class.

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

Warning: will cause memory leaks 5 years 6 months ago #14139

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
to be sure: call PDFLayoutView.PDFClose() before Document.Close() invoked.
this log print when Page object finalized by GC, and Document object closed.

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

Warning: will cause memory leaks 5 years 6 months ago #14140

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
Yes, I'm calling PDFLayoutView.PDFClose(), then Document.Close().

I went back to test it some more, and now it's no longer happening. I don't remember which device I was using when I saw this yesterday. If I see it again, I'll post more info.

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

  • Page:
  • 1
Powered by Kunena Forum