Home > Net >  Short tcpclient thread connection repeated requests, memory leak problem
Short tcpclient thread connection repeated requests, memory leak problem

Time:11-15

Scenario is like that, I this is the client, the request data to a number of robots, some robots may not boot is not on, I opened a thread here, to request data, finish the request and then close the connection, some robot connection would be an error, but I also released the resources after an error, but the memory still rising fast, an hour to blow, this have what way

CodePudding user response:

If the situation is you sell 100 w, so you need to take the initiative to request 100 w
So, in the normal way he sent to you, not you ask him,

Stay here for so many years, of course, I know what you will say, you will say "I'm going to be so, don't you tube"

So we can only back, has nothing to do with technology, it is a strategy problem, the solution: pooling, current limiting, retreats, fall right, fusing,
These words is not technology, just strategy, with a lot of things can be achieved, at present, we can recommend to you is polly library
https://www.nuget.org/packages/Polly/
https://github.com/App-vNext/Polly

CodePudding user response:

Use redgate to have a look at that memory object, most properly with a single instance,

CodePudding user response:

Why memory will rise? Post your "debug out" rose code memory, which is specific regarding line (line number) code, which is a variable memory accumulation, not careless said a specious argument,

CodePudding user response:

The so-called "open threads" this is a specious concepts, in fact, some people are holding the "queue, blocking," the idea to design concurrent programs, not asynchronous concepts,

Real asynchronous don't block, while at the same time connect 100000 chanel, for example, not to say that the threads blocked 100000 1, assume that at the same time there are 10 to the message arrival is only up to 10 threads to deal with, this is an asynchronous multi-threaded processing, rather than what block multithreading,

About multithreaded programming design, some are old specious "queue, producers, consumers, jam, semaphore" concept, and so on to mislead, and grasp the key - no obstruction, concept,
  •  Tags:  
  • C#
  • Related