0

This is more of a question and an answer. I had noticed in iOS 9 I had no memory issues using the CGPDF Library, and flipped through x amount of pages with no issues. See the attached screenshot, notice each page swipe the memory went down: iOS 9 Instrument Allocations/Leaks

However in iOS 10, the exact same PDF and code had a crashing issue when you swipe a certain amount of pages. The app would crash from memory allocations. See attached screenshot, continuous rise in memory:

ios 10 allocations

I'm posting this as a question of if anyone else has encountered this issue with iOS 10, how I fixed the issue was to CGPDFDocumentRelease in the didReceiveMemory warning and then immediately reload my CGPDFDocument, which let the app continue without crashing on iOS 10. After adding the release in the didReceiveMemory, my instruments looks like this, I have not tested on iOS 11 beta yet:

ios 10 after fix

Jh2170
  • 116
  • 4

1 Answers1

0

The fix was to add CGPDFDocumentRelease in the didReceiveMemory warning and then immediately reload my CGPDFDocument

Jh2170
  • 116
  • 4