What are the most common (and often overlooked) causes of memory leaks in managed (.net) applications?

后端 未结 11 945
闹比i
闹比i 2021-02-04 09:32

Please can anyone recommend a quick checklist / best practice guide to help us avoid simple (but subtle) mistakes that cause could cause memory leaks in .net apps

I find

11条回答
  •  时光说笑
    2021-02-04 09:48

    Number one would be event handlers that are attached and never detached.

    If the subscriber to the event lives longer than the producer of the event and the subscriber doesn't disconnect the event handler then object firing the events will remain alive as there's still a reference to it through the subscribing object.

提交回复
热议问题