文档彩票走势图>>Stimulsoft Reports.WinForms教程-2019>>Stimulsoft Reports.WinForms教程:ENGINEV1和ENGINEV2内存测试
Stimulsoft Reports.WinForms教程:ENGINEV1和ENGINEV2内存测试
立即点击下载Stimulsoft Reports.Ultimate最新版
此示例比较了使用旧V1和新V2报表引擎时的内存消耗。让我们使用一个复杂的Master-Detail报表进行比较。每次构建之后,您可以调用垃圾收集器并查看内存消耗:
public Form1() { InitializeComponent(); var data = new DataSet(); data.ReadXmlSchema("..\\..\\Data\\Demo.xsd"); data.ReadXml("..\\..\\Data\\Demo.xml"); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MemoryTest.Master-Detail-Subdetail.mrt")) { report1.RegData(data); report1.Load(stream); report1.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV1; report1.Compile(); } using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("MemoryTest.Master-Detail-Subdetail.mrt")) { report2.RegData(data); report2.Load(stream); report2.EngineVersion = Stimulsoft.Report.Engine.StiEngineVersion.EngineV2; report2.Compile(); } } 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();
}
在下面的屏幕截图中,您可以看到示例代码的结果。