NDrawingViewControl Memory Leak


Author
Message
RLDP 2000
RLDP 2000
Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)
Group: Forum Members
Posts: 11, Visits: 385
Hi Nevron Support,

I would like to report a problem with a possible memory leak encountered when using NDrawingViewControl in WPF application.
Here is my setup:

Sample Application:
29% of original size (was 1727x666) - Click to enlarge
This is a simple WPF Application (.NET Framework 4.7.2, using NOV version 24.6.3.12).

When I open then close the PageDialog, my memory consumption does not decrease.
I am also forcing the call to the garbage collector on PageDialog.Closed event.


Here is my CustomCanvas class
61% of original size (was 824x521) - Click to enlarge

I also checked memory leaks using JetBrain's dotMemory profiler to confirm if memory leak occurs.
35% of original size (was 1460x1667) - Click to enlarge
I hope I was able to explain well the details of this possible issue.

If you want to check my full demo app, please provide details on how I can share my source code with you.


I hope you have already a solution for this issue.
I would appreciate it if you can share the solution with me.

Thanks.


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
Hi Jan,

Thank you for the detailed description of the issue and the screenshots. It would be great if you send us a sample project that demonstrates the issue. We will then be able to debug it and tell you what's wrong and how to fix it. You can add a ZIP archive with your project to a new comment in this forum topic or upload it to a cloud service of your choice and send a download link in a new comment.

Thank you!


Best Regards,
Nevron Support Team


RLDP 2000
RLDP 2000
Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)Forum Member (28 reputation)
Group: Forum Members
Posts: 11, Visits: 385
Hi,

Thank you for the response.
I have attached the demo code.

Thanks.
Attachments
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.1K
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();
}


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;



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Login

Explore
Messages
Mentions
Search