Page Index Toggle Pages: [1] 2  Send TopicPrint
Very Hot Topic (More than 25 Replies) PDFExporter Memory Leak (Read 15625 times)
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
PDFExporter Memory Leak
May 12th, 2008 at 8:45pm
Print Post  
Hello,

In my code I loop through a database creating flowcharts into Visio and PDF format.

After creating roughly 80 pdf's I am running into out of memory issues. If I just create Visio's I have no issues.

When the last visio (before it dies) is exported all of the nodes are grayed out - not sure if that helps!

Let me know what I can do to help you with this.
Barry
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #1 - May 12th, 2008 at 8:47pm
Print Post  
Sorry, mis-typed there!

>When the last visio (before it dies) is exported all of the nodes are grayed out - not sure if that helps!

Should be, when the last PDF dies! Visio Exporting is working without issues.

Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #2 - May 13th, 2008 at 2:36pm
Print Post  
Is there any exception thrown after the 80th PDF, and could you paste the stack-trace here? Are you using the same PdfExporter instance to export all files?
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #3 - May 13th, 2008 at 4:12pm
Print Post  
Hello,

Yup, after the 80th there is an exception thrown, see stack dump below. As well, I am using the same pdfexporter for all exports.

   at System.Drawing.Graphics.GetHdc()
   at MindFusion.Drawing.GdiGraphics.GetHdc()
   at MindFusion.Pdf.PdfGraphics.GetHdc()
   at MindFusion.Pdf.PdfFont.xed0095cff33220da(Font x26094932cf7a9139)
   at MindFusion.Pdf.PdfFont..ctor(Font font, PdfPage _page)
   at MindFusion.Pdf.PdfPage.AddFont(Font font)
   at MindFusion.Pdf.PdfText..ctor(PdfPage _page, Font font, Brush _brush, String s, StringFormat format, RectangleF _layoutRect)
   at MindFusion.Pdf.PdfGraphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
   at MindFusion.Diagramming.ShapeNode.xeda13f64d938197c(IGraphics x41347a961b838962, RenderOptions xdfde339da46db651)
   at MindFusion.Diagramming.ShapeNode.xc79d59e9288101bd(IGraphics x41347a961b838962, RectangleF xa6236fc5cd405c4e, Boolean x2f9dabff87b2168b, Brush xb45de92d01a0ec1f, Pen x9c79b5ad7b769b12, RenderOptions xdfde339da46db651)
   at MindFusion.Diagramming.ShapeNode.Draw(IGraphics graphics, RenderOptions options)
   at MindFusion.Diagramming.Diagram.x83e1efc9aa69ada9(IGraphics x41347a961b838962, DiagramItem xccb63ca5f63dc470, Boolean x9c41bb4d9b3b314f)
   at MindFusion.Diagramming.Diagram.x679ae26de3befa07(IGraphics x41347a961b838962, RectangleF xd0772cd9ac472b96, Boolean x979174172ae18db3)
   at MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
   at MindFusion.Diagramming.Export.PdfExporter.Export(Diagram diagram, String filePath)
   at VectorFlow.frmFlow.LoadDiagram() in D:\FlowChart\Flow\frmFlow.vb:line 741


Hope this helps!
Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #4 - May 14th, 2008 at 2:49pm
Print Post  
Hi Barry,

Look for updated assemblies in the private messages page (there is a link to it at the top of the forum page). Please try exporting to PDF with them and let me know if there is any improvement.

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #5 - May 14th, 2008 at 3:16pm
Print Post  
Hello,

I copied this into my MindFusion directory (after backing up the original... and I have the following compiler errors when I attemp to run it:


Error: The dependency 'MindFusion.Pdf, Version=1.0.2901.27726, Culture=neutral, PublicKeyToken=0b3a610038a66854' in project 'VectorFlow' cannot be copied to the run directory because it would conflict with dependency 'MindFusion.Pdf, Version=1.0.3056.29537, Culture=neutral, PublicKeyToken=0b3a610038a66854'.

Error: The dependency 'MindFusion.Pdf, Version=1.0.3056.29537, Culture=neutral, PublicKeyToken=0b3a610038a66854' in project 'VectorFlow' cannot be copied to the run directory because it would conflict with dependency 'MindFusion.Pdf, Version=1.0.2901.27726, Culture=neutral, PublicKeyToken=0b3a610038a66854'.
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #6 - May 14th, 2008 at 3:41pm
Print Post  
Ignore that last post, I didn't add a reference to Mindfusion.pdf (I don't think I needed that before)!

Here is my error now: (happens right away)

   at System.Drawing.Graphics.FromImage(Image image)
   at MindFusion.Diagramming.Diagram.CreateMeasureGraphics()
   at MindFusion.Diagramming.Diagram.x8bf95fac764336fc()
   at MindFusion.Diagramming.Diagram.Draw(IGraphics graphics, RenderOptions options, RectangleF clipRect, Boolean noModifiedItems)
   at MindFusion.Diagramming.Export.PdfExporter.Export(Diagram diagram, String filePath)
   at VectorFlow.frmFlow.LoadDiagram() in D:\Flowchart\frmFlow.vb:line 741

Once done, I see another message box that says: Invalid Parameter Used


Barry
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #7 - May 14th, 2008 at 3:43pm
Print Post  
Traced through the code again... seems to happen on the second export in the loop.

Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #8 - May 14th, 2008 at 5:04pm
Print Post  
Could you call SaveToXml and email the diagram file to support@mindfusion.eu?

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #9 - May 14th, 2008 at 5:06pm
Print Post  
Sure, do you want me to set it back to the old version, or the current one?


Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #10 - May 14th, 2008 at 5:26pm
Print Post  
Doesn't matter, the XML file should be the same. Could you also post your PdfExporter initialization code?

Stoyan
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #11 - May 14th, 2008 at 5:42pm
Print Post  
Sure, I didn't think there was much code to initialize this.

I have:
    Dim pdfExp As New MindFusion.Diagramming.Export.PdfExporter

... at the start of the program

Then I call this for each loop.

pdfExp.Export(VectorView.Diagram, OutputDir & "\Flowchart " & Number & ".pdf")


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #12 - May 14th, 2008 at 5:45pm
Print Post  
Does it also happen if you move the pdfExp declaration inside the loop - so that there is a new PdfExporter instance used for each exported file?
  
Back to top
 
IP Logged
 
mclellan
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 45
Location: London, Ontario
Joined: Feb 11th, 2008
Re: PDFExporter Memory Leak
Reply #13 - May 14th, 2008 at 5:59pm
Print Post  
Hello,

Just tried it, new version still dies after the first export, the old version dies at 80 pdf exports.

Top of each loop
   Declared PDF Export
   Exported
  Set PDFExport = Nothing
  Back to top of loop


Barry
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: PDFExporter Memory Leak
Reply #14 - May 15th, 2008 at 11:00am
Print Post  
Unfortunately I could not reproduce that. Could you also post the initialization code for your Diagram object? If you are doing any custom drawing, please also post the Draw-event handlers code.

Thanks,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint