Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Stimulsoft Reports.NET discussion
Post Reply
ngothitien123cs
Posts: 3
Joined: Mon Dec 12, 2022 6:31 am

Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by ngothitien123cs »

We have an application with a Stimulsoft .Net server to generate the reports.

We find that every time we generate another report the memory usage goes up. This is both virtual memory and physical memory. After many times of doing this, we managed to get the memory usage of more than 800MB (both virtual and physical), then we'd get memory errors.
It means It is working fine, but it's leaving a memory leak every time this function is executed

The detail:
  • Main method handle: GetStimulsoftReport and GetMergedStimusoftReportByLanguage
    1Main method handle GetStimulsoftReport and GetMergedStimusoftReportByLanguage.png
    1Main method handle GetStimulsoftReport and GetMergedStimusoftReportByLanguage.png (115.79 KiB) Viewed 1484 times
  • Just start the model, not call any request
    Just start model not call any request.png
    Just start model not call any request.png (97.87 KiB) Viewed 1494 times
  • Click call some requests:
    Unmanaged memory hight and not resolve
    Take more memory for SitTex, String, byte[],….
    Click call some requests.png
    Click call some requests.png (1.26 MiB) Viewed 1494 times
    Memory analyze.png
    Memory analyze.png (338.41 KiB) Viewed 1494 times
    MemoryUsing.png
    MemoryUsing.png (212.11 KiB) Viewed 1494 times
The cause is related to methods: StiNetCoreReportResponse.ResponseAsPdf Or StiNetCoreReportResponse.ResponseAsXls
I try to add some code to clear data but not works:
1. Using the Clear method
2. Dispose()
3. GC.Collect()
stiReport.Dictionary.DataStore.Clear();
stiReport.CompiledReport.DataStore.Clear();
stiReport.RenderedPages.Clear();
StiCacheCleaner.Clean(stiReport);
stiReport.Dispose();
stiReport = null;
//Forza il garbage collector a liberare la memoria allocata dall'assembly e dai dati
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
Could anyone please help me? How do we resolve the memory?
Last edited by ngothitien123cs on Mon Dec 12, 2022 10:15 am, edited 3 times in total.
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by Lech Kulikowski »

Hello,

Please check the last release build.
If the issue is still present, please send us a sample project that reproduces the issue for analysis.

Thank you.
ngothitien123cs
Posts: 3
Joined: Mon Dec 12, 2022 6:31 am

Re: Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by ngothitien123cs »

Hello,
Currently, we use "Stimulsoft.Reports.Web.NetCore" Version="2022.3.4"
The issue happens when we call: StiNetCoreReportResponse.ResponseAsPdf Or StiNetCoreReportResponse.ResponseAsXls method (please view the above image for detail)
With this version how can we resolve the memory leak?
Please feel free to contact me if you need any information.
Thank you.
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by Lech Kulikowski »

Hello,

Please try to set the CalculationMode=Interaction property for the report. If the issue is still present, please send us a sample project that reproduces the issue for analysis.

Thank you.
ngothitien123cs
Posts: 3
Joined: Mon Dec 12, 2022 6:31 am

Re: Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by ngothitien123cs »

Hello,
Thank you for the information,
After I apply to set the CalculationMode=Interaction property for the report, the memory of the service is reduced, meaning: This speeds up the building of a report or dashboard and reduces the required amount of RAM
For this point, we have many reports, so we need to set that property value for each report.
I see one piece of information on the documentation page:
https://www.stimulsoft.com/en/documenta ... n_mode.htm
Calculation mode info.PNG
Calculation mode info.PNG (11.03 KiB) Viewed 1426 times
The questions:
  • 1, How about this case if we set it in the code? And how do we handle setting it by .Net code?
  • 2, Now Do we just only set this value in the report template of the Stimulsoft designer?
  • 3, Is there any difference when we switch between the two options, which is different from the data in the result file when generated?
Thank you.
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: Resolve memory after using memory in Stimulsoft .Net - Memory Leak

Post by Lech Kulikowski »

Hello,

Please check the following article:
https://www.stimulsoft.com/en/blog/arti ... on-blockly

Thank you.
Post Reply