Assembly leak vs dll cache
Posted: Wed Mar 17, 2021 11:15 am
Hi Stimulsoft,
we are using your software to allow users to build their own custom reports.
These report can be single paged or multi paged with the content of the layout being used for each page but with different data.
One of our customers called us with a problem that the application was reaching 40 GB of memory consumption.
After analyzing the dump file we found several thousands of assembly files loaded into memory, we discovered that these assemblies had Stimulsoft code.
We asked the customer and they told us that most of the reports had more than 350 pages and they were doing more than 2000 prints in under 3 hours.
The application runs 24/7 and cannot be restarted to recover the memory.
After debugging we discovered that for each page of the report, a new assembly was created and loaded into memory when the Render method is called (one page = one subreport).
We tried to overcome this problem by using the CreateReportInNewAppDomain method but got serialization exceptions, on the same article that describes the usage of CreateReportInNewAppDomain we also found the cache dll strategy (https://stimulsoft.zendesk.com/hc/en-us ... assemblies), this seemed to be the most logical solution and we tried to use it.
Unfortunately we had some issues, if, for some reason, we load the subreport layout from a byte[] everything works great (except for the assembly leak), but, if we load from the assembly (created after loading the report from the byte[]) the report is empty.
We built a sample application to demonstrate this behavior (attached to this post you can find the source code. password: stimulsoft).
In the sample application if you pass any argument to the .exe you disable the cache and the assembly leak is demonstrated, if you start the application, without any argument, then you see that the only the 1st page of the 1st report has data, all the other pages are empty for the 1st report and for report 2 and 3, we have no data.
If loading the layout from an assembly solves the problem, could you please show us what we are doing wrong?
Hope you can help us to stop this problem from occurring.
Note: for the sample application we are using the latest version of stimulsoft, in the real application we are still using the Stimulsoft.Reports.Web.2018.2.3 version
Best Regards
we are using your software to allow users to build their own custom reports.
These report can be single paged or multi paged with the content of the layout being used for each page but with different data.
One of our customers called us with a problem that the application was reaching 40 GB of memory consumption.
After analyzing the dump file we found several thousands of assembly files loaded into memory, we discovered that these assemblies had Stimulsoft code.
We asked the customer and they told us that most of the reports had more than 350 pages and they were doing more than 2000 prints in under 3 hours.
The application runs 24/7 and cannot be restarted to recover the memory.
After debugging we discovered that for each page of the report, a new assembly was created and loaded into memory when the Render method is called (one page = one subreport).
We tried to overcome this problem by using the CreateReportInNewAppDomain method but got serialization exceptions, on the same article that describes the usage of CreateReportInNewAppDomain we also found the cache dll strategy (https://stimulsoft.zendesk.com/hc/en-us ... assemblies), this seemed to be the most logical solution and we tried to use it.
Unfortunately we had some issues, if, for some reason, we load the subreport layout from a byte[] everything works great (except for the assembly leak), but, if we load from the assembly (created after loading the report from the byte[]) the report is empty.
We built a sample application to demonstrate this behavior (attached to this post you can find the source code. password: stimulsoft).
In the sample application if you pass any argument to the .exe you disable the cache and the assembly leak is demonstrated, if you start the application, without any argument, then you see that the only the 1st page of the 1st report has data, all the other pages are empty for the 1st report and for report 2 and 3, we have no data.
If loading the layout from an assembly solves the problem, could you please show us what we are doing wrong?
Hope you can help us to stop this problem from occurring.
Note: for the sample application we are using the latest version of stimulsoft, in the real application we are still using the Stimulsoft.Reports.Web.2018.2.3 version
Best Regards