WPF memory leak

前端 未结 6 1961
生来不讨喜
生来不讨喜 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:14

    Leave the garbage collector alone and let it do its job.

    What you're describing isn't a memory leak. It's dynamic memory not getting released at the moment you think it ought to be released.

    Are you the garbage collector? You are not. Worrying about when garbage gets collected isn't your job. If these objects are actually garbage - and they are - the memory will be there when you need it.

提交回复
热议问题