Reputation: 1198
I'm trying to use ExecutorService.newFixedThreadPool
to running several tasks. Every time I submit to ExecutorService
, I will new a class()
which holds task related information.
Will it cause memory leak as time goes?
For example, will there be 1M classes if I submit()
1M times?
Upvotes: 3
Views: 587
Reputation: 100152
No the executor service will not hold a reference beyond the lifetime of the task.
Upvotes: 2