The memory usage in a C # (.NET) application is very large until I call System.GC.Collect ()

I wrote an application that combines several threads, each of which reads several MB of memory. Then each stream connects to the Internet and downloads data. this happens thousands of times and each download takes some time

I see a situation where (checked with windbg / sos and! Dumpheap) that bytes [] are not collected automatically, as a result of which 100 / 150MB of memory is reported in the task manager

if I call System.GC.Collect (), I see a huge drop in memory, a drop of more than 100 MB

I do not like to call System.GC.Collect (), and my computer has a lot of free memory. however, if someone looks at the TaskManager, they will be worried, thinking that my application is running badly.

advice?

+3
source share
2 answers

The problem is that some users check the memory and processor usage, and also report that your application consumes too much, even if there is no problem with their performance. I think they do this to show their boss / girlfriend / fellows how much they know about computers.

A carefully selected CG.Collect in your application is likely to reduce this problem (and not the computer). I think you should do it.

+3
source

, . "" - (, ), , , ( ?).

+12

Source: https://habr.com/ru/post/1742632/


All Articles