文檔首頁(yè)>>Stimulsoft Reports.WinForms教程-2019>>Stimulsoft Reports.WinForms教程:ENGINEV1和ENGINEV2內(nèi)存測(cè)試
Stimulsoft Reports.WinForms教程:ENGINEV1和ENGINEV2內(nèi)存測(cè)試
立即點(diǎn)擊下載Stimulsoft Reports.Ultimate最新版
此示例比較了使用舊V1和新V2報(bào)表引擎時(shí)的內(nèi)存消耗。讓我們使用一個(gè)復(fù)雜的Master-Detail報(bào)表進(jìn)行比較。每次構(gòu)建之后,您可以調(diào)用垃圾收集器并查看內(nèi)存消耗:
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();
}
在下面的屏幕截圖中,您可以看到示例代碼的結(jié)果。