Memory optimization

Hi,
i load a PDF and iterate throught the pages using this code

            Dim syncfPDF As New Syncfusion.Pdf.Parsing.PdfLoadedDocument(File, Password)
            syncfPDF.EnableMemoryOptimization = True

            Dim loadedPages As Syncfusion.Pdf.Parsing.PdfLoadedPageCollection = syncfPDF.Pages
            Dim syncfPage As Syncfusion.Pdf.PdfPageBase
            Dim extractedText As String = String.Empty

            For i = 0 To loadedPages.Count - 1
                syncfPage = loadedPages(i)
                extractedText = syncfPage.ExtractText()
            Next

While the "for loop" is beeing executed the single pages are loaded into memory, that means images and other objects on the page are loaded into memory.
I suppose images are also uncompressed while loading into memory.

The allocated memory seems not to be disposed by syncfPage = loadedPages(i) when the next page is asigned to syncfPage.
So the memory consumptions increases rapidly only due to iterating through the pages to get the page text.

Is there a way to immediately dispose the page and release memory when it is not used anymore?
F.e. like

            For i = 0 To loadedPages.Count - 1
                syncfPage = loadedPages(i)
                extractedText = syncfPage.ExtractText()
                syncfPage.dispose
            Next

Thanks.


1 Reply

SP Sathya Ponnusamy Syncfusion Team December 1, 2017 01:03 PM UTC

Hi Olaf Mohr, 
 
Thanks for your update. 
 
We have analyzed the reported memory holdup issue based on the provided code snippet and we could find some bottleneck for better memory optimization. It will be helpful if you could share us the input document to ensure the stability of our fix changes. Please follow the incident which you have created for this query for further follow-up. 
  
Regards, 
Sathya 


Loader.
Up arrow icon