ASP.NET Website Memory Usage quite high

前端 未结 7 1268
灰色年华
灰色年华 2020-12-14 18:54

I have an ASP.NET website that will hit about 2gb physical memory used within about 3-4 days, which to me sounds really bad. At the moment, I have configured IIS to restart

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 19:27

    If your ASP.NET application uses events (and which one doesn't), then you have to make sure you unsubscribe from the event.

    Rule of thumb:

    If you use += to subscribe to an event, then you need to use -= in the Dispose() method to unsubscribe.

    There are lots of resources on this topic, and I've had a bit of pain in applications I've worked in because your run-of-the-mill programmer doesn't realize that events can cause memory leaks.

提交回复
热议问题