本文介绍了如何在线程池中设置最大线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行项目时,线程的计数将增加,大约30分钟后,线程的计数将增加到1000+,并导致OutOfMemory异常。

我试图使用ThreadPool.SetMaxThreads来限制线程的最大数量,而我不知道哪些数量的最大线程是合适的。它是否与计算机核心有关系?

解决方案

when I run the projects, the counts of the threads will increase ,and after about 30 minutes the counts of the threads will be to 1000+, and cause the OutOfMemory Exception.
I have tried to use the ThreadPool.SetMaxThreads which will limited the max counts of the threads, while I don't know which numbers of the max threads would be suitable. Does it be relational with the cores of the computers?

解决方案


这篇关于如何在线程池中设置最大线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 17:45