MVC ASP.NET is using a lot of memory

前端 未结 6 2099
谎友^
谎友^ 2021-02-14 09:53

If I just browse some pages on the app, it sits at around 500MB. Many of these pages access the database but at this point in time, I only have roughly a couple of rows each for

6条回答
  •  失恋的感觉
    2021-02-14 10:29

    Add a GC.Collect() to the Dispose method for testing purposes. If the leak stays it is a real leak. If it vanishes it was just delayed GC.

    You did that and said:

    @usr Memory usage now hardly reaches 600MB. So really just delayed?

    Clearly, there is no memory leak if GC.Collect removes the memory that you were worried about. If you want to make really sure, run your test 10 times. Memory usage should be stable.

    Processing such big files in single chunks can lead to multiplied memory usage as the file travels through the different components and frameworks. It can be a good idea to switch to a streaming approach.

提交回复
热议问题