Don't keep the PDF in memory during creation and then try to flush. Instead, use CGPDFContextCreateWithURL
so that only the 'current' page being created is in memory and each time you create a new page the data is pushed to disk. This will keep the memory usage to a minimum.
As for not receiving the notification, if your PDF generation is running synchronously on the main thread then the notification will never be posted (it will just be waiting on the queue to be processed).