Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon May 03, 2021 1:41 pm

Hi, my application has been leaking GDI handles and crashing eventually when it hits 10,000 handles.
I did some debugging and the GDI handles increase by 30 and never release them each time I print a document. So I am pretty confident that this issue is related to SpirePDF.
When I call pdf.print(), it spawns 30 new handles and when I exit .print(), those handles are still there even when I exit the running thread.
(no specific category shown on GDIView but total number increases)

SpirePdf.dll version: 7.4.13.0
I run this on a background thread. Code:
Code: Select all
using (PdfDocument pdf = new PdfDocument((filePath + Filename)))
                                {
                                    try
                                    {
                                        pdf.PrintSettings.PrintController = new StandardPrintController();
                                        pdf.PrintSettings.DocumentName = Filename;
                                        pdf.PrintSettings.PrinterName = settings.ActivePrinter;
                                        pdf.Print();
                                    }

                                    catch
                                    {
                                        // Some error handling.
                                    }
          Thread.Sleep(200);
          pdf.PrintSettings.Dispose();
          pdf.Dispose();
          pdf.Close();
}

fyukcell41
 
Posts: 1
Joined: Mon May 03, 2021 1:30 pm

Tue May 04, 2021 7:14 am

Hello,

Thanks for your inquiry.
I did an initial test but I didn't reproduce your issue. To help us investigate further, please provide us with your input file and your OS information (e.g. Win7 64bit), you can send them to us ([email protected]) via email. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Mon May 10, 2021 9:14 am

Hello,

Has your issue been resolved? If not, could you please provide your input file to us for further investigation?

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF