MishaUliutin/MuPDF.WinRT

Out of Memory Exception | Load PDF Page by Page

Closed this issue · 2 comments

Hi,
I am using this library for Windows Phone 8. I have requirement of loading a PDF one page at a time and when user swipe the screen, then load the next page. I am using additional thread using "Thread Class" or "Task" to load the pdf page. If previous thread is not completed it cancelled the thread and starts new one to load the next page. But I am facing a "Out of memory exception" after loading the 10-12 pages.
Sometimes it also throwing "Stackoverflow exception" while using "document.DrawPage(0, pixels, 0, 0, sizeX, sizeY, false);" method.
So please help me out?? How can I solve this problem?

Hi,
First of all you should find out where is the problem, on managed side or unmanaged side? For this you could use e.g. such code https://bitbucket.org/mishauliutin/pdf-reader-for-wp8-public/src/a6e2ae0a63c24e75afc8eb405ad080c1c158dd5d/PdfReader/LowLevelMemoryProfiler.cs?at=default. If problem in unmanaged try different value for maxStore (Maximum size in bytes of the resource store, before it will start evicting cached resources such as fonts images.) parameter in Document.Create method.

Best Regards,
Misha Uliutin

Thanks for ur reply. I Will try the same.