Alua-Kinzhebayeva / iOS-PDF-Reader

PDF Reader for iOS written in Swift
MIT License
532 stars 150 forks source link

App Terminated due to memory issue #88

Open najoua opened 6 years ago

najoua commented 6 years ago

Hi,

I am using your library, thank you so much for this. But actually i'am facing a problem, I am using big Pdf files with important resolution, and unfortunatelythe app crashes because of that. Could you help me solving the problem please, it's very urgent.

NB: I tried to decrease the resolution and it works much better with some file, but it's not a good solution, because i don't know when the app may stop.

Thank you for help

fulviomoya commented 6 years ago

Hi, I have the same problem using documents of ~220MB, because the PDF files we've tried to open has high resolutions and the library cannot allocate and deallocate the memory too fast causing will crash the app.

Try this temporal solution:

  1. Create PDFViewController using the parameter isThumbnailsEnabled equal to false. PDFViewController.createNew(with: pdfDocument, title: fileName, isThumbnailsEnabled: false).

  2. Remove / comment the function loadPages on PDFDocument.swift which

    Extracts image representations of each page in a background thread and stores them in the cache.