Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Wed Mar 28, 2018 2:54 pm

Hi all,

I've just purchased your Solution "Spire.PDF Platinum Pack"

Now I have expirienced some horrible memory leaks, that just are not acceptable.

I'm using Spire.PdfViewer in a WPF Project.. Everything works fine, the registration was successfully.

Now I'm having a scenario where my users will Load a PDFStream in my PDFViewer Control like so:

Code: Select all
public void AddDocumentToPdfViewer(byte[] source)
{
    using (System.IO.MemoryStream xms = new System.IO.MemoryStream(source))
    {
       PDFDocumentViewer.LoadFromStream(xms);
    }
}


Now imagine, this stream is some MB. This function is called maybe 10-20 times.. But you PDFViewerControl does not dispose the used memorystream, even if I call PDFDocumentViewer.CloseDocument() and GC.Collect().

I did this while debugging in VisualStudio and my Application Memory became really fast over 1-2 GB!

Could you please guide me, how I can prevent a memory-loss in that situation?

Kind Regards

iseag
 
Posts: 15
Joined: Thu Feb 01, 2018 10:32 am

Thu Mar 29, 2018 6:46 am

Hello,

Thanks for your post. I have noticed the issue and logged it into our bug tracking system with high priority. Once it's fixed or there is any update, we will inform you. We apologize for the inconvenience caused.

Best regards,
Simon
E-iceblue support team.
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Apr 09, 2018 5:48 am

Dear Support Team

Is there already a hotfix for this issue?

I would need a working solution asap!

Thanks
Luca

iseag
 
Posts: 15
Joined: Thu Feb 01, 2018 10:32 am

Mon Apr 09, 2018 8:16 am

Hello,

Thanks for your inquiry. I am sorry the issue has not been fixed yet. Actually, I tired to load the PDF stream which is 5MB for about 20 times. The memory increased indeed, but it was around 200MB of growth instead of 1-2GB. After disposing the resource, it reduced about 100MB.
By the way, what's the file size of your PDF? When disposing the resource, did you dispose the stream and bytes array together? We will appreciate it if you could share us with the PDF file for investigation.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Apr 09, 2018 12:37 pm

Dear Support Team,

I just tested again with your sample --> Spire.PdfViewer --> WpfDemos --> PdfViewer --> HelloWorld-VS2015 Project

my documents (uploaded as zip), they are not complete as I can only upload 3 attachments and each max. 2MB...
They contain a lot of black, though that should not be a problem?
If you need anymore files, please get in contact with me via mail (luca.hostettler(at)iseag.ch)

I have 10 pdf's and while running the application around 2-3 minutes I switched from one to another every 10 seconds (so like 20-50 times).

While debugging in VS I can see that the Process Memory is going up and never comes down around 100MB (Screenshot)

Please contact me for any further details

Regards

iseag
 
Posts: 15
Joined: Thu Feb 01, 2018 10:32 am

Tue Apr 10, 2018 8:28 am

Hello,

Thanks for sharing the information and documents. At present, I am not sure if the issue is caused by your documents. However I have forwarded your documents to our DEV team for further investigation. If there is any feedback from them, we will let you know.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Sat Apr 28, 2018 8:13 am

Hi,

Do you have any information at present, or a hotfix for my issue?

Thanks and kind regards

iseag
 
Posts: 15
Joined: Thu Feb 01, 2018 10:32 am

Mon Apr 30, 2018 2:43 am

Hello,

Thanks for your following up.
The issue still is being analyzed due to its complexity. I requested our dev team to share an ETA at their earliest. We will update you as soon as we get a feedback.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed May 16, 2018 9:38 am

Hello,

Glad to inform you that the issue has been fixed. Please click below link to download the new version and refer to the code snippet to have a try.
https://www.e-iceblue.com/downloads/Tem ... _3.5.2.zip
Code: Select all
        MemoryStream ms = new MemoryStream();

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "PDF document(.pdf)|.pdf";

            if ( dialog.ShowDialog().Value)
            {
                string pdfDocument = dialog.FileName;
                ms = new MemoryStream(File.ReadAllBytes(pdfDocument));
                this.PdfDocumentViewer1.CloseDocument();
                this.PdfDocumentViewer1.LoadFromStream(ms);
                ms.Dispose();
                ms.Close();
                GC.Collect();
            }
        }


Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Fri May 18, 2018 7:37 am

Hello,

How is the issue going? Has the hotfix resolved your issue?
Your feedback will be greatly appreciated.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue May 22, 2018 9:07 am

Hi All,

Thanks for your effort, the issue is fixed now, though the loading of big pdf streams does take long, but thats another issue.

Your help is really appreciated.

Regards

iseag
 
Posts: 15
Joined: Thu Feb 01, 2018 10:32 am

Tue May 22, 2018 9:37 am

Hello,

Thank you for your valuable feedback.
It is inescapable that long time is needed when the document you are loading is too big.
If the issue bothers you much, just send the document to us for further investigation.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDFViewer