WPF memory leak

前端 未结 6 1955
生来不讨喜
生来不讨喜 2021-01-13 00:35

I have a simple wpf application. In main window i have stack panel and 2 buttons. First button adds 100 my user controls (without any data bindings, events, bitmaps), and se

6条回答
  •  借酒劲吻你
    2021-01-13 01:38

    I would concur with @Aliostad re GC. I does its job very well, BUT it is not a tool to magically clear all of your memory.

    If you have memory leak problems, the most straightforward and reliable solution is to use a profiler, whih should be able to identify if you have a genuine leak and where it is. I have used Ants from Red Gate, but others may have better suggestions.

    As well as following the usual guidelines, like making sure you properly dispose of stuff. Calling GC and hoping that it will work is not an alternative for proper code assessment.

提交回复
热议问题