This is a migrated thread and some comments may be shown as answers.

Not releasing the memory after completion of rendering - ReportProcessor.RenderReport

1 Answer 284 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kris
Top achievements
Rank 1
Kris asked on 12 Sep 2016, 01:03 AM
Hi,

We have below lines of code for exporting the report in XLS format. 

After running performance test using windows performance monitor tool, we observed high memory utilization while executing RenderReport method.

However the serious concern is RenderReport method is not releasing the memory after finishing its execution. Need your urgent help/support. 

Additional design information - 

The Telerik report uses report controller as a DataSource & its action method as a DataMember. Action method consumes WCF service which gets the data from the database. RenderReport method internally makes a call to this action method which executes fine (not much memory utilization) however after that when it receives the data (type as List) from action method and  starts actual rendering with the data & template, it suddenly starts utilizing high memory which it fails to release after completion.

Minimum number of records tested  - 390 approx.

More information - 
Telerik.Reporting versions used:   8.1.14.804 & 10.1.16.615
Dev machine details:                     Intel I5/2.4Ghz processor, 8 GB RAM

=====================================================================================================================

var reportProcessor     =new ReportProcessor();
var deviceInfo              =new Hashtable();
var typeReportSource =new TypeReportSource();

typeReportSource.TypeName = Type.GetType(typeof(T).Namespace + "." + reportName).AssemblyQualifiedName;

typeReportSource.Parameters.AddRange(parameters);

var result = reportProcessor.RenderReport(reportExportType, typeReportSource, deviceInfo);

string fileName = result.DocumentName + "." + result.Extension;
string path        = System.IO.Path.GetTempPath();
string filePath   = System.IO.Path.Combine(path, fileName);

using (MemoryStream ms = new MemoryStream())
{
    ms.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    ms.Flush(); 
    FileContentResult fileContentResult = new FileContentResult(ms.GetBuffer(), result.MimeType);
    fileContentResult.FileDownloadName = fileName;
    return fileContentResult;
}

=====================================================================================================================

1 Answer, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 12 Sep 2016, 12:13 PM
Hello Kris,

I will post here the reply from the support ticket you opened on the same question:

"In general, report processing and rendering are memory intensive operations. During the report generation, besides the retrieved data there are newly generated resources by the report which are held in memory. Thus, the machine should have enough memory and CPU to handle the amount of data and the document processing.
For more detailed information and suggestions for improving the report's performance please check Performance Considerations help article.

Note, that controlling when the garbage collector fires  not done by us. You can force the garbage collection if required - check this MSDN article."


In the end of this reply, there is a list of the additional information we would need in order to provide you further suggestions.


Regards,
Katia
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Kris
Top achievements
Rank 1
Answers by
Katia
Telerik team
Share this question
or