简体   繁体   中英

Wpf RadDocking memory leak

I was tracking a problem of memory leak related to an event handler,while I've discovered that each time I open a raddoCking then I close it I got around 500kb of memory used and not released. I'm using MVVM pattern and as far I've seen its not related to the mvvm library.

When I close a RadPane I set it context to null hasn't it enough? Thanks

You need to call RadPane's RemoveFromParent() method for it to be garbage collected.

Please check out these links:

http://www.telerik.com/forums/radpanegroup-memory-leak

http://www.telerik.com/forums/radpane-not-garbage-collected-when-closed

Few Points:

  1. Setting RadPane's context to null isn't enough. You should unsubscribe from any event subscription to any long lasting objects and call Dispose for all disposable objects.

  2. How do you measure memory? It would not release memory right after you close the RadPane. Garbage collection occurs only when it is required. If you want to test memory usage you should call GC collect and finalization before that.

    GC.Collect();

    GC.WaitForPendingFinalizers();

However, if you want to track memory leaks accurately, you need to use a proper profiling tool which would show you growing objects and their retention graphs.

Have a look at this answer for a good memory profiler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM