I have a large set of tasks that need to be done with multithreading .
I use ExecutorService to send a large number of Callable objects , and each Callable object contains several resource that are needed to execute.
Problem
These tasks are so many that the Callable objects presented in the ExecutorService take up too much memory, then the heap exhausted.
I want to know when the JVM free up space for these Callable objects ?
It does this right after the task is completed, and how can I manage the memory used for the ExecutorService ?
I want to control the ExecutorService view, for example, when there is not enough memory, and then block sending, some of the completed tasks and free space are performed. Could it be?
All the code is too complicated, I will attach the main frame of my code.
public class MyCallable implements Callable<Result> { ...
Auguste
source share