Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Get text for 16.5MB PDF = 2.5GB RAM.....causing crashes.

$
0
0
Hi

Boiled it down to a simple example where trying to get the text from a single PDF uses huge amounts of memory, the problem we have is when running a few in parallel it kills the system or leads to out of memory exceptions, the ratio of 16.5MB to 2.5GB seems crazy

        static void Main(string[] args)
        {
            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
            pdfLicense.SetLicense(@"C:\Aspose.Pdf.lic");

            Aspose.Pdf.Document doc = new Aspose.Pdf.Document(@"C:\Lenovo Manual.pdf");

            Aspose.Pdf.Text.TextAbsorber textAbsorber = new Aspose.Pdf.Text.TextAbsorber();

            long workingSet = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
            Console.WriteLine(String.Format("BEFORE [Mem:{0}]", workingSet.ToString()));

            doc.Pages.Accept(textAbsorber);

            workingSet = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
            Console.WriteLine(String.Format("AFTER [Mem:{0}]", workingSet.ToString()));
            
            string docText = textAbsorber.Text;
            
            Console.WriteLine("Done");
            Console.ReadLine();
        }

Would appreciate any help on how we can fix this problem.

Cheers

Simon

Viewing all articles
Browse latest Browse all 3131

Trending Articles