Use FlushPages() function regularly while creating huge PDF files.
It writes the pages to disc which have already been processed. This way you can create PDF files which do not fit in memory.
I just created an example which can easily create a 10000 page PDF with 8 GB in size.
10 05 11 - 19:11