Using ThreadPool to limit memory usage in C #

I have an application that generates print jobs for separate threads so that the main thread of the application is not blocked. The problem I'm running into is an OutOfMemory exception when there are too many concurrent threads. Using a ThreadPool to limit the number of concurrent threads does not help as the print jobs depend on each memory usage (for example, some reports use heavy graphics and thousands of pages, while others only use two pages).

Is there a way to manage and idle new threads in a thread pool based on the total SIZE of the pool and not the number of threads?

Thanks in advance for any help.

+3


source to share





All Articles