This example makes a comparison of the memory consumption when using the old V1 and new V2 report engines. Let's use a complex Master-Detail report for comparison. After each build, you can invoke the garbage collector and see the memory consumption:
public Form1()
{
InitializeComponent();
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MemoryTest.MasterDetailSubdetail.mrt"))
{
report1.Load(stream);
report1.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV1;
report1.Compile();
}
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MemoryTest.MasterDetailSubdetail.mrt"))
{
report2.Load(stream);
report2.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2;
report2.Compile();
}
}
StiReport report1 = new StiReport();
StiReport report2 = new StiReport();
private void button1_Click(object sender, EventArgs e)
{
report1.Render();
}
private void button2_Click(object sender, EventArgs e)
{
report2.Render();
}
private void button3_Click(object sender, EventArgs e)
{
report1.RenderedPages.Clear();
GC.Collect();
GC.Collect();
GC.Collect();
}
private void button4_Click(object sender, EventArgs e)
{
report2.RenderedPages.Clear();
GC.Collect();
GC.Collect();
GC.Collect();
}