|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Out of Memory Exceptionthrough with a For Each loop. There are 500+ records in this DataSet. For each record, I'm creating a PDF by exporting an ActiveReport. So the basic logic flow is: Dim rpt As Main = New Main ' This is the activereport For Each dr In dv.Table.Rows <set rpt values here> rpt.Run(False) Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = New DataDynamics.ActiveReports.Export.Pdf.PdfExport xPDF.Export(rpt.Document, mStream) pdfPath = Request.PhysicalApplicationPath & "\collection\temppdfs\" & dr("List_ID") & ".pdf" xPDF.Export(rpt.Document, pdfPath) xPDF.Dispose() Next I'm only able to get about 200 through before it gives me an Out of Memory exception. Seems like there is an obvious design flaw, and I'm just not sure how to structure this so it "reuses" memory. Any thoughts? Thanks! To start off, I am not at all familiar with the DataDynamics library.
It looks like for every report, you are calling the Export method twice. Is there a reason for that? What is 'mStream'? Some sort of stream object? How is it being instantiated? Are you closing it? Show quote "James" <minork***@gmail.com> wrote in message news:%23zshThTbGHA.4060@TK2MSFTNGP02.phx.gbl... > Should be an easy one for you veterans. Have a DataSet that I'm looping > through with a For Each loop. There are 500+ records in this DataSet. > For each record, I'm creating a PDF by exporting an ActiveReport. So the > basic logic flow is: > > Dim rpt As Main = New Main ' This is the activereport > > For Each dr In dv.Table.Rows > <set rpt values here> > rpt.Run(False) > > Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = New > DataDynamics.ActiveReports.Export.Pdf.PdfExport > xPDF.Export(rpt.Document, mStream) > pdfPath = Request.PhysicalApplicationPath & "\collection\temppdfs\" > & dr("List_ID") & ".pdf" > > xPDF.Export(rpt.Document, pdfPath) > xPDF.Dispose() > Next > > I'm only able to get about 200 through before it gives me an Out of Memory > exception. Seems like there is an obvious design flaw, and I'm just not > sure how to structure this so it "reuses" memory. Any thoughts? > > Thanks! > Whoops, 95% sure that's for exporting it to the browser where it actually
opens the PDF. I "borrowed" the code from their site and I'm pretty sure that line should be commented. Running a test shortly to see if that has anything to do with it. Thanks for picking up on that! Show quote "Marina Levit [MVP]" <someone@nospam.com> wrote in message news:urWHzkTbGHA.4116@TK2MSFTNGP05.phx.gbl... > To start off, I am not at all familiar with the DataDynamics library. > > It looks like for every report, you are calling the Export method twice. > Is there a reason for that? > > What is 'mStream'? Some sort of stream object? How is it being > instantiated? Are you closing it? > > "James" <minork***@gmail.com> wrote in message > news:%23zshThTbGHA.4060@TK2MSFTNGP02.phx.gbl... >> Should be an easy one for you veterans. Have a DataSet that I'm looping >> through with a For Each loop. There are 500+ records in this DataSet. >> For each record, I'm creating a PDF by exporting an ActiveReport. So the >> basic logic flow is: >> >> Dim rpt As Main = New Main ' This is the activereport >> >> For Each dr In dv.Table.Rows >> <set rpt values here> >> rpt.Run(False) >> >> Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = New >> DataDynamics.ActiveReports.Export.Pdf.PdfExport >> xPDF.Export(rpt.Document, mStream) >> pdfPath = Request.PhysicalApplicationPath & >> "\collection\temppdfs\" & dr("List_ID") & ".pdf" >> >> xPDF.Export(rpt.Document, pdfPath) >> xPDF.Dispose() >> Next >> >> I'm only able to get about 200 through before it gives me an Out of >> Memory exception. Seems like there is an obvious design flaw, and I'm >> just not sure how to structure this so it "reuses" memory. Any thoughts? >> >> Thanks! >> > > Alas, no luck. I can comment out that line and all references to the
mStream object...but I'm still getting the OOM Exception =/. So, basically, the code is the same, sans that one line you referenced. Show quote "James" <minork***@gmail.com> wrote in message news:eTzcrnTbGHA.3408@TK2MSFTNGP04.phx.gbl... > Whoops, 95% sure that's for exporting it to the browser where it actually > opens the PDF. I "borrowed" the code from their site and I'm pretty sure > that line should be commented. Running a test shortly to see if that has > anything to do with it. Thanks for picking up on that! > > "Marina Levit [MVP]" <someone@nospam.com> wrote in message > news:urWHzkTbGHA.4116@TK2MSFTNGP05.phx.gbl... >> To start off, I am not at all familiar with the DataDynamics library. >> >> It looks like for every report, you are calling the Export method twice. >> Is there a reason for that? >> >> What is 'mStream'? Some sort of stream object? How is it being >> instantiated? Are you closing it? >> >> "James" <minork***@gmail.com> wrote in message >> news:%23zshThTbGHA.4060@TK2MSFTNGP02.phx.gbl... >>> Should be an easy one for you veterans. Have a DataSet that I'm looping >>> through with a For Each loop. There are 500+ records in this DataSet. >>> For each record, I'm creating a PDF by exporting an ActiveReport. So >>> the basic logic flow is: >>> >>> Dim rpt As Main = New Main ' This is the activereport >>> >>> For Each dr In dv.Table.Rows >>> <set rpt values here> >>> rpt.Run(False) >>> >>> Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = New >>> DataDynamics.ActiveReports.Export.Pdf.PdfExport >>> xPDF.Export(rpt.Document, mStream) >>> pdfPath = Request.PhysicalApplicationPath & >>> "\collection\temppdfs\" & dr("List_ID") & ".pdf" >>> >>> xPDF.Export(rpt.Document, pdfPath) >>> xPDF.Dispose() >>> Next >>> >>> I'm only able to get about 200 through before it gives me an Out of >>> Memory exception. Seems like there is an obvious design flaw, and I'm >>> just not sure how to structure this so it "reuses" memory. Any >>> thoughts? >>> >>> Thanks! >>> >> >> > > First off, comment out all the lines of code that actuall export the
document. See if it is running the report that is the problem. If the OOM exception goes away when you do that, then I would contact the component provider and talk to them about it. Otherwise, the memory problem is with running the report. Show quote "James" <minork***@gmail.com> wrote in message news:%234mYGwTbGHA.2368@TK2MSFTNGP03.phx.gbl... > Alas, no luck. I can comment out that line and all references to the > mStream object...but I'm still getting the OOM Exception =/. So, > basically, the code is the same, sans that one line you referenced. > > "James" <minork***@gmail.com> wrote in message > news:eTzcrnTbGHA.3408@TK2MSFTNGP04.phx.gbl... >> Whoops, 95% sure that's for exporting it to the browser where it actually >> opens the PDF. I "borrowed" the code from their site and I'm pretty sure >> that line should be commented. Running a test shortly to see if that has >> anything to do with it. Thanks for picking up on that! >> >> "Marina Levit [MVP]" <someone@nospam.com> wrote in message >> news:urWHzkTbGHA.4116@TK2MSFTNGP05.phx.gbl... >>> To start off, I am not at all familiar with the DataDynamics library. >>> >>> It looks like for every report, you are calling the Export method twice. >>> Is there a reason for that? >>> >>> What is 'mStream'? Some sort of stream object? How is it being >>> instantiated? Are you closing it? >>> >>> "James" <minork***@gmail.com> wrote in message >>> news:%23zshThTbGHA.4060@TK2MSFTNGP02.phx.gbl... >>>> Should be an easy one for you veterans. Have a DataSet that I'm >>>> looping through with a For Each loop. There are 500+ records in this >>>> DataSet. For each record, I'm creating a PDF by exporting an >>>> ActiveReport. So the basic logic flow is: >>>> >>>> Dim rpt As Main = New Main ' This is the activereport >>>> >>>> For Each dr In dv.Table.Rows >>>> <set rpt values here> >>>> rpt.Run(False) >>>> >>>> Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = >>>> New DataDynamics.ActiveReports.Export.Pdf.PdfExport >>>> xPDF.Export(rpt.Document, mStream) >>>> pdfPath = Request.PhysicalApplicationPath & >>>> "\collection\temppdfs\" & dr("List_ID") & ".pdf" >>>> >>>> xPDF.Export(rpt.Document, pdfPath) >>>> xPDF.Dispose() >>>> Next >>>> >>>> I'm only able to get about 200 through before it gives me an Out of >>>> Memory exception. Seems like there is an obvious design flaw, and I'm >>>> just not sure how to structure this so it "reuses" memory. Any >>>> thoughts? >>>> >>>> Thanks! >>>> >>> >>> >> >> > > I would suggest you to use a memory profiler to find the cause of the
problem. You might also check .net performance counters. But I think it has to be something with activereports becuase a DataSet with 500+ records doesn't mean anything to memory usage. Perhaps a reasonable solution would be to create a simple sample that repros the issue and send it to DD support. -- Show quoteMiha Markic [MVP C#] RightHand .NET consulting & development www.rthand.com Blog: http://cs.rthand.com/blogs/blog_with_righthand/ "James" <minork***@gmail.com> wrote in message news:%23zshThTbGHA.4060@TK2MSFTNGP02.phx.gbl... > Should be an easy one for you veterans. Have a DataSet that I'm looping > through with a For Each loop. There are 500+ records in this DataSet. > For each record, I'm creating a PDF by exporting an ActiveReport. So the > basic logic flow is: > > Dim rpt As Main = New Main ' This is the activereport > > For Each dr In dv.Table.Rows > <set rpt values here> > rpt.Run(False) > > Dim xPDF As DataDynamics.ActiveReports.Export.Pdf.PdfExport = New > DataDynamics.ActiveReports.Export.Pdf.PdfExport > xPDF.Export(rpt.Document, mStream) > pdfPath = Request.PhysicalApplicationPath & "\collection\temppdfs\" > & dr("List_ID") & ".pdf" > > xPDF.Export(rpt.Document, pdfPath) > xPDF.Dispose() > Next > > I'm only able to get about 200 through before it gives me an Out of Memory > exception. Seems like there is an obvious design flaw, and I'm just not > sure how to structure this so it "reuses" memory. Any thoughts? > > Thanks! > |
|||||||||||||||||||||||