none
ReportViewer SP1 & Visual Studio 2010 Memory Problem RRS feed

  • Question

  • Hello,

    I have a serious memory problem with this component.

    I have one ReportViewer component in my form loading dynamically rdlc reports.

    Everytime that I change the report, I can see the memory growing and growing, and hitting the memory exception.

    Sometimes (randomly), the memory is relatively freed, but it stills a random appearence.

    I searched all the forums but I couldn't find an appropriate solution. Such as:

    MainReportViewer.LocalReport.DataSources.Clear();

    or things like:

    MainReportViewer.LocalReport.ReleaseSandboxAppDomain();

    Or even...

    GC.Collect();
    GC.WaitForPendingFinalizers();

    No serious results....

    All I can see in my task bar, a process growing growing.... reaching 1GB of memory usage... Sometimes freeing the memory - with some delays, sometimes hitting Out of Memory.

    My question: Is there a way to force the ReportViewer to FREE the used memory. So that I can force it before showing the next rdlc?

    You have a serious problem with this viewer guys. And please don't tell me to put it on server for scalability reasons :) (as mentioned in other forums) Because the same report can be shown using another viewer control (not to name it), with less than 100 MB of Memory utilization (in addition to a very intelligent lazy loading techniques).

     

    Saturday, October 15, 2011 5:23 PM

All replies

  • Are you able to fix this problem, i am facing the same issue...

     


    KC
    Thursday, December 8, 2011 11:38 PM
  • Hello,

    I was able to fix the problem through workarounds.

    I don't know if Microsoft has provided new patches that fixes this problem.

     

    Let me ask you few questions:

    - How many report viewers are you using in your program? More than one instance?

    - Do you have charts and tables (i.e. datas) in your reports? What kind of content do you have in your report?

    - Are you using the filters (in the charts or in the tables)?

    - Do you have big & complicated SQL statement (feeding the DataTable)?

    - Roughly speaking, how many records is your SQL query returning?

    - What is the size of your database?

    - Are you using sub reports?

    Let me know, I'll try to help you as much as I can.

     

    Friday, December 9, 2011 4:59 PM
  • I am having the same issue it seems. I am printing an invoice report in a loop with the using a non-visible report viewer and after a few hundred reports it just crashes the debugger and I have to exit VS and reload the solution.

    To answer your questions:

    I have a single report viewer being reused for each iteration.

    I have several text fields and a single table.

    I am not using filters.

    I am not using DB connections, this report has an object as its datasource.

    No subreports.

    Any insight would be greatly appreciated, as printing the reports is the last piece of this project.

    Out of curiosity, what is the other report viewer that you are not naming? I would love another option if I cannot work out this issue.

    Saturday, December 10, 2011 12:52 AM
  •  

    Hello,

    Please find below my answers:

    I have a single report viewer being reused for each iteration.

    => That's great, beacause the framework is not able to clean the unused report viewer quickly. In addition, the report viwer, by default, has at least one additional thread that execute the calculation. Which, I think, is the reason why GC is not able to clean it properly. 

    I have several text fields and a single table.

    ==> Are you sure that you are using one single table from the database? I think that you have at least a structure like master detail no?

    ==> Specially if you are creating an invoice, I beleive that you will have an address table, orders table, and a details table. If that's the case, I will highly recommend you to use the sub reports. try to check the example below and let me know:

    http://cid-3c7e963ff6ccd974.office.live.com/self.aspx/.Public/LocalReports.zip

    ==> By using the sub reports, you will be able to move the bottleneck from the Memory bound and transfer it to CPU bound....

    The other report viewer that I was refering to was the SAP Crystal Report Viewer. That comes with VS 2010. Nothing to compare between those two products, specially if you are dealing with big volumes.... Now the drawback is that, it seems to be less user friendly than the Report Viewer.

    • Edited by Jakobian Saturday, December 10, 2011 8:22 AM
    Saturday, December 10, 2011 8:20 AM