From: Paul Cager on
On Apr 22, 2:18 pm, Francesco <f.pall...(a)gmail.com> wrote:
> I'm trying to submit to ExecutorService many processCallable (I have
> to use callable because I have to feedback the returncode), but over a
> quantity my JVM goes in OutOfMemory.
>
> My Executor is:
>
>         private ExecutorService executor = Executors.newFixedThreadPool(30);
>
> I can't modify Xms and Xmx because they are too high now.
> I want to clean-up the pool by the completed threads, so I can put the
> newer.
>
> Have You some ideas?
>
> Thanks a lot
> F.

If you have a fixed thread pool there shouldn't be any completed
threads - I'd guess something is holding on to completed jobs (or
Futures if you are using them).

If you are using a Sun JVM you can add startup flag "-XX:
+HeapDumpOnOutOfMemoryError" to make sure you get a heap dump on OOM.
I find "MAT" (http://www.eclipse.org/mat/) a good way to analyse heap
dumps (much better than jhat).
From: Francesco on
On 22 Apr, 16:03, Paul Cager <paul.ca...(a)googlemail.com> wrote:
> On Apr 22, 2:18 pm, Francesco <f.pall...(a)gmail.com> wrote:
>
>
>
>
>
> > I'm trying to submit to ExecutorService many processCallable (I have
> > to use callable because I have to feedback the returncode), but over a
> > quantity my JVM goes in OutOfMemory.
>
> > My Executor is:
>
> >         private ExecutorService executor = Executors.newFixedThreadPool(30);
>
> > I can't modify Xms and Xmx because they are too high now.
> > I want to clean-up the pool by the completed threads, so I can put the
> > newer.
>
> > Have You some ideas?
>
> > Thanks a lot
> > F.
>
> If you have a fixed thread pool there shouldn't be any completed
> threads - I'd guess something is holding on to completed jobs (or
> Futures if you are using them).
>
> If you are using a Sun JVM you can add startup flag "-XX:
> +HeapDumpOnOutOfMemoryError" to make sure you get a heap dump on OOM.
> I find "MAT" (http://www.eclipse.org/mat/) a good way to analyse heap
> dumps (much better than jhat).

Thanks
I'll try with it.