C # WebClient memory usage

I am using WebClient, DownloadString (" http://example.com/string.txt "); When I call it, the memory jumps up, but never drops again, and since I need 2-3 different lines downloaded from the Internet, the memory bounces very much.

I'm new to C # and still learning, but still, to clear my memory after I downloaded a line from the Internet? If not, do you know any other methods that I can use to read from the Internet using less memory?

thank

+3
source share
2 answers

WebClient IDisposable, :

string result;
using (WebClient client = new WebClient())
{
    result = client.DownloadString("http://example.com/string.txt");
}
Console.WriteLine(result);

, WebClient.

. .

+8

" ", , Taskmgr.exe ProcExp.exe, , . , . , . , , , .

, . - . , .

+3

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


All Articles