Causes the threads are on the increase at the same time, the memory is growing, CPU and memory will explode,
Then optimized the method of thread running time and memory processing, but still faces a 100% CPU often lead to stuck, if use a thread pool to control open the queue for a maximum of four threads, CPU and stable operation, but memory will overflow,
At that time what kind of good way?
CodePudding user response:
I remember the thread pool to execute tasks, performed feedback can perform again next, can completely solve the resource abuseCodePudding user response:
"Doctor, I have a headache"The doctor said that "to do the check first
"
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Here, we don't like blog garden, have a headache is murder, then say "aspirin", so now we will not give you a prescription,
You have to use vs their diagnostic tools, to the actual detection, what accounts for the memory,
CodePudding user response:
1 using a thread pool, should be no problem2 out of memory, you check whether there is a Shared variables without recycling,
CodePudding user response:
If there is no Shared variables, then it may be the problem of large objects,This need you to optimization of large objects, or add threads memory size,
CodePudding user response:
Machine operation ability, memory capacity is so big, if determined to make its ability to deal with more than their things, certainly will lack the resources,The thread pool can alleviate the optimization scheduling, can't completely solve this problem,
May increase the CPU, more memory is the most direct, most violent solution,
CodePudding user response:
You can use the queue, thread pool, limit the number of concurrent threadsCodePudding user response:
I kept open new thread- "thread quite a waste of resources, too much thread will cause the CPU usage, the best number of CPU cores, refer to # 6 suggested that limit the number of concurrent threads and query Task usage,
Memory explosion, of course, may also be caused by not only the threads, such as release unmanaged resources occupation, not in time without using a cache, etc.,
CodePudding user response:
Out of memory and thread processing is not absolute, can only say that thread execute the task itself to resources recycling is problematic,CodePudding user response: