Hi Jan,
Thank you for the sample
project. We analyzed it and found the issue. Because you are not using native Nevron windows (NTopLevelWindow instances), you should clear them manually from the Nevron Open Vision (NOV) Desktop's Windows collection. Please update the code of the PageDialog's PageDialog_Closed event handler to:
private void PageDialog_Closed(object sender, EventArgs e)
{
canvas.ActivePage.Items.Clear();
// Remove the display window of the canvas from the Windows collection of the NOV Desktop object
NApplication.Desktop.Windows.Remove(canvas.DisplayWindow);
canvas = null;
Closed -= PageDialog_Closed;
//GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
GC.Collect();
GC.WaitForPendingFinalizers();
}
private void PageDialog_Closed(object sender, EventArgs e)
{
canvas.ActivePage.Items.Clear();
// Remove the display window of the canvas from the Windows collection of the NOV Desktop object
NApplication.Desktop.Windows.Remove(canvas.DisplayWindow);
canvas = null;
Closed -= PageDialog_Closed;
//GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
GC.Collect();
GC.WaitForPendingFinalizers();
}
If you decide to use the NOV windows (NTopLevelWindow instances) for the windows and the dialogs of your application, it won't be necessary to manually remove the window from the NOV desktop's Windows collection. For more information on top-level windows, please see the following article:
NOV Top Level Windows
You can also disable the hardware acceleration (GPU rendering) and the paint cache to further reduce memory usage. Please note that that the paint cache can use a specific amount of memory up to a given limit to cache some paint information an textures in order to speed up the rendering. Add the following code in the beginning of the entry point of your application - the "App.OnStartup" method override:
NApplication.EnableGPURendering = false;
NApplication.PaintCacheSettings.Enabled = false;
NApplication.EnableGPURendering = false;
NApplication.PaintCacheSettings.Enabled = false;
Best Regards,
Nevron Support Team