OutOfMemory using ThreadPoolExecutor

Discussion in 'Java' started by Francesco, Apr 22, 2010.

  1. Francesco

    Francesco Guest

    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.
    Francesco, Apr 22, 2010
    #1
    1. Advertising

  2. Francesco

    Paul Cager Guest

    On Apr 22, 2:18 pm, Francesco <> 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).
    Paul Cager, Apr 22, 2010
    #2
    1. Advertising

  3. Francesco

    Francesco Guest

    On 22 Apr, 16:03, Paul Cager <> wrote:
    > On Apr 22, 2:18 pm, Francesco <> 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.
    Francesco, Apr 23, 2010
    #3
  4. Francesco

    HameedDeen

    Joined:
    Jan 17, 2012
    Messages:
    1
    Multi client communicates the server at a time

    Hi All,

    Iam new to this forum,

    I am doing the stand alone application for multi file transfereing from many clients machine to server machine using socket communication in java .I did the code to transfer files for single client to server its working fine now ,


    At a time nearly 50 to 100 client machines will send many files to server.
    How my server to handle this situation ? please advise

    I am not aware of Thread Pool Executor .
    can I Implement Thread Pool Executor part in both sever side and client side ?

    please give some idea to complete my requirement. Thanks in Advance .Expecting your valuable response








    HameedDeen, Jan 17, 2012
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    803
  2. Marc E
    Replies:
    0
    Views:
    661
    Marc E
    Apr 29, 2006
  3. Maciej
    Replies:
    1
    Views:
    636
    Thomas Hawtin
    Oct 27, 2006
  4. Replies:
    11
    Views:
    21,099
  5. pksiazek
    Replies:
    2
    Views:
    1,547
    pksiazek
    Oct 15, 2007
Loading...

Share This Page