Page 2 of 4

memory leaks

Posted: Thu Dec 30, 2010 2:19 am
by Ivan
Hello,
Mpanal wrote:Tell me an email for send you the report.
Please send your report to support@stimulsoft.com.

Thank you.

memory leaks

Posted: Thu Dec 30, 2010 3:18 am
by Mpanal
Ivan wrote:Hello,
Mpanal wrote:Tell me an email for send you the report.
Please send your report to support@stimulsoft.com.

Thank you.
Sent

Thank you

memory leaks

Posted: Thu Dec 30, 2010 3:32 am
by Alex K.
Hello,

Ok. Thank you.

memory leaks

Posted: Tue Jan 11, 2011 7:01 pm
by mattdone
Hello. In the list of changes for 22 Dec 2010 (Pre-Release Builds), you say you added a new StiOptions.Engine.ReportCache.AllowGCCollect static property. Does this mean that you are caching reports and not disposing them and therefore not releasing memory after each report is generated? Also does this mean that if I set this property to true it may fix the memory leak issues we are having, (as listed in the above post)?

memory leaks

Posted: Wed Jan 12, 2011 12:00 am
by Andrew
Hello,
Hello. In the list of changes for 22 Dec 2010 (Pre-Release Builds), you say you added a new StiOptions.Engine.ReportCache.AllowGCCollect
static property. Does this mean that you are caching reports and not
disposing them and therefore not releasing memory after each report is generated?

ReportCache is responsible only for caching of pages of the current report on disk (the StiReport.ReportCacheMode property).

The GarbageCollector itself should clear the memory from unused objects.
Forced calling of the GC.Collect() method is not recommended as it can very significantly delay the execution of the application.
But in practice, the Garbage Collector is invoked very rarely, and when actively using memory, it does not manage to clear the memory.
Therefore, we have added a forced call of the GC.Collect() method after processing a defined number of pages.
To manage it the following properties are used:

StiOptions.Engine.ReportCache.AllowGCCollect (by default true)
and
StiOptions.Engine.ReportCache.AmountOfProcessedPagesForStartGCCollect (by default 20).
Also does this mean that if I set this property to true it may fix the memory leak issues we are having, (as listed in the above post)?
In the previous topic we have already described the reason of your problem and solution for it.
The properties specified by you do not refer to this problem.

Thank you.

memory leaks

Posted: Wed Jan 12, 2011 10:21 am
by Mpanal
Mpanal wrote:
Ivan wrote:
Also you can try to test the new Interpretation mode of report rendering.
For select this mode, please set the CalculationMode property of the report:

Code: Select all

 report.CalculationMode = StiCalculationMode.Interpretation;
Thank you.

I have also problems with memory.

When I try calculation mode Interpretation, I have an error message: "Syntax error near }" I have many "}" on my report. How I can know where is the error?

If calculation mode is Compilation, I have no error. But after 100 - 120 reports, my program hangs for memory consumption.

Thank you

Advancing on my problem. The syntax error is a SQL Client error. I am using several tables with syntax like: "Select * from mytable where myfield = {myvariable}".

This use is for parametrize the SQL command from my program. On compiled version, the report renders correctly, but on interpretated mode the "{myvariable}" is not converted to their value. If I hardcode the SQL command to the value of the variable, the report render. How I can parametrize the Selects from my program on interpreted mode?

Another question. Once I passed the syntax error and render my report, the result report have only 1 page. On compiled version have 32 pages. ???????

Thank you.

memory leaks

Posted: Thu Jan 13, 2011 12:36 am
by Andrew
Hello,

The Interpretation mode is a beta version now.
But we are actively finalizing it.
Many simple reports are already rendered the same way as in the Compilation mode.

Thank you.

memory leaks

Posted: Tue Mar 08, 2011 6:07 pm
by mattdone
Hi, We are still recieveing quite a substantial memory leak using your product. We are alomst at a point where it is so severe we may have to stop using your product, which would be a shame as we really like it.

Could you please let us know what stimulsoft is doing to address the memory leaks your product causes. Included below is the code we now have to use to reduce the leak from about 1gb per day to 500mb per day.

Code: Select all

	private bool exportToStimulsoft(string reportFile, MemoryStream ms, DataSet data, ESA.Framework.Modelling.ModelObject host)
        {
            bool ok = false;
			string dll = null;
			//check for a precompiled version
			try
			{
				dll = reportFile.ToLower().Replace(".mrt", ".dll");
				bool recompile = !host.Session.fileExistsFS(dll);
				if (!recompile)//check file timestamps
				{
					DateTime mrtDate = host.Session.fileTimestampFS(reportFile);
					DateTime dllDate = host.Session.fileTimestampFS(dll);
					recompile = (mrtDate.CompareTo(dllDate) > 0);
				}
				if (recompile)
				{
					using (StiReport toCompile = new StiReport())
					{
						toCompile.Load(reportFile);
						toCompile.DataSources.Clear();
						toCompile.Dictionary.Databases.Clear();
						toCompile.Dictionary.ImportXMLSchema(data);
						CompilerResults r = StiReport.CompileReportsToAssembly(dll, new StiReport[] { toCompile }, StiReportLanguageType.CSharp);
						Logger.logInformation("Compiled Stimulsoft report into " + dll);
					}
				}
			}
			catch (Exception ex)
			{
				Logger.logError("Error compiling report " + reportFile, ex);
				dll = null;
			}
			if (dll != null)
			{
				try
				{
					StiReport report = StiReport.GetReportFromAssembly(dll, false);
					StiOptions.Engine.ReportCache.AllowGCCollect = true;
					report.RegData(data);
					Stimulsoft.Report.Export.StiPdfExportSettings settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
					settings.Compressed = true;
					settings.EmbeddedFonts = false;
					settings.ImageQuality = host.ReportImageQuality;

                    publishStimulsoftRuntimeVariables(report);

					report.Render(false);
					report.ExportDocument(StiExportFormat.Pdf, ms, settings);
					report.Dictionary.DataStore.Clear();
					data.Clear();
					data.Dispose();
					report.Dispose();
					ms.Seek(0, SeekOrigin.Begin); //rewind stream - stimulsoft used to but does not any more
					ok = true;
				}
				catch (Exception ex)
				{
					Logger.logError("Error executing report from dll:" + reportFile, ex);
					File.Delete(dll);
				}
			}
			if(!ok)
			{
				using (StiReport report = new StiReport())
				{
					try
					{
						report.Load(reportFile);
						report.DataSources.Clear();
						report.Dictionary.Databases.Clear();
						report.Dictionary.ImportXMLSchema(data);
						report.RegData(data);
						Stimulsoft.Report.Export.StiPdfExportSettings settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
						settings.Compressed = true;
						settings.EmbeddedFonts = false;
                        settings.ImageQuality = host.ReportImageQuality;

                        publishStimulsoftRuntimeVariables(report);

						report.Render(false);
						report.ExportDocument(StiExportFormat.Pdf, ms, settings);
						report.Dictionary.DataStore.Clear();
						data.Clear();
						data.Dispose();
						report.Dispose();
						ms.Seek(0, SeekOrigin.Begin); //rewind stream - stimulsoft used to but does not any more
						ok = true;
					}
					catch (FormatException fex)
					{
						host.setMessageToken(1, fex.Message);
						host.setMessageToken(2, reportFile);
						host.addSystemMessage(UserMessage.Severity.Error, reportFile + ": Format Exception:" + fex.Message, "RPT_FormatException");
						ok = false;
					}
					catch (Exception ex)
					{
						host.setMessageToken(1, ex.Message);
						host.setMessageToken(2, reportFile);
						host.addSystemMessage(UserMessage.Severity.Error, reportFile + ": There is a problem with the data sent to the report:" + ex.Message, "RPT_Exception");
						ok = false;
					}
				}
			}
            return ok;
        }
A fully reproducible project was included earlier in this thread by Radek. We can also provide you with any detail you need to backup our claim. If you attach a memory diagnostics tool to this test you will see what we are talking about. You are also doing a lot of clean up code in the finally of a try catch block. Which is recommend against, as it may never get collected.

Thanks guys. We really like your product and hope that this memory leak is addressed asap as it it causing us a great deal of pain.

Matt.

memory leaks

Posted: Wed Mar 09, 2011 1:13 am
by Andrew
Hello,

Please send to support@stimulsoft.com the "freshest" test project with all changes, for investigation.
We are glad to help you.

Thank you.

memory leaks

Posted: Tue Mar 22, 2011 9:26 pm
by Radek Cerny
Andrew wrote:Hello,

Please send to support@stimulsoft.com the "freshest" test project with all changes, for investigation.
We are glad to help you.

Thank you.
I have emailed the reproducible test program. We have also discvered a new bug in compiled reports - images on the mrt cause excepptions when loading from the dll - this is also included in the test application.

Cheers

Radek