Getting System.OutOfMemoryException when using ReportViewer contol in Local mode
2010-02-04 16:52
1321 查看
PROBLEM:
========
Consider you've a ASP.NET application that contains Report Viewer control (2005 / 2008) in Local Mode.
You have an RDLC report file, that loads large amount of data / has lots of expressions. (Both are not recommended in Local mode)
Everytime you refresh the web page, the Report Viewer stores objects in the session.
The behaviour of Report Viewer storing objects in the session is by design.
Each time the report viewer page is refreshed the complete report info object is added to session.
These objects obviously gets deeply rooted in session and so Garbage collector never collects them untill the complete app unloads itself.
And that is apparently going to increase the memory pressure in multiple folds, ending up with System.OutOfMemoryException.
RESOLUTION: (Please note: This doesn't guarantee to resolve the exception. The Out of Memory exception can be caused due to different reasons and the below workaround is for one such scenario, which can help to avoid this error to a certain extent.)
===========
== In the page_load event, add this,
if(Session.Count > 0)
{
for (int i = 0; i < Session.Count; i++)
{
if (Session[i].GetType().ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
{
Session.RemoveAt(i);
}
}
}
source: http://blogs.msdn.com/selvar/archive/2008/07/18/getting-system-outofmemoryexception-when-using-reportviewer-contol-in-local-mode.aspx
========
Consider you've a ASP.NET application that contains Report Viewer control (2005 / 2008) in Local Mode.
You have an RDLC report file, that loads large amount of data / has lots of expressions. (Both are not recommended in Local mode)
Everytime you refresh the web page, the Report Viewer stores objects in the session.
The behaviour of Report Viewer storing objects in the session is by design.
Each time the report viewer page is refreshed the complete report info object is added to session.
These objects obviously gets deeply rooted in session and so Garbage collector never collects them untill the complete app unloads itself.
And that is apparently going to increase the memory pressure in multiple folds, ending up with System.OutOfMemoryException.
RESOLUTION: (Please note: This doesn't guarantee to resolve the exception. The Out of Memory exception can be caused due to different reasons and the below workaround is for one such scenario, which can help to avoid this error to a certain extent.)
===========
== In the page_load event, add this,
if(Session.Count > 0)
{
for (int i = 0; i < Session.Count; i++)
{
if (Session[i].GetType().ToString() == "Microsoft.Reporting.WebForms.ReportHierarchy")
{
Session.RemoveAt(i);
}
}
}
source: http://blogs.msdn.com/selvar/archive/2008/07/18/getting-system-outofmemoryexception-when-using-reportviewer-contol-in-local-mode.aspx
相关文章推荐
- System.OutOfMemoryException error thrown when running ReportViewer
- Problems with System.OutOfMemoryException At System.String.GetStringForStringBuilder in 32-Bit Managed Solutions
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- Problems with System.OutOfMemoryException At System.String.GetStringForStringBuilder in 32-Bit Managed Solutions
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- Using the ASP.NET 2.0 ReportViewer in Local Mode
- 异常--Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: PermGen space
- Net 调式案例—实验3 内存(Memory)回顾 System.OutOfMemoryException
- c#中 Exception of type 'System.OutOfMemoryException' was throw的解决办法
- dot Text Error: System.OutOfMemoryException
- sqlserver,执行生成脚本时“引发类型为“System.OutOfMemoryException”的异常”
- Exception in thread "HSQLDB Connection @429be9" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Tomcat内存溢出的原因--Exception in thread “RMI TCP Connection(idle)” ---OutOfMemoryError: PermGen space
- : tomcate 报 PermGen space 错误Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
- SQL Server出现System.OutOfMemoryException异常的解决方法
- .net 中的bug:System.OutOfMemoryException At System.String.GetStringForStringBuilder
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "http-8080-3" java.lang.OutOfMemoryError: PermGen space
- 引发类型为“System.OutOfMemoryException”的异常。 遍历DataGridView 获取行错误