Number of threads with respect to JVM memory (1.5b2 running on 2.6 linux)

Discussion in 'Java' started by Soeren Gerlach, Jul 15, 2004.

  1. Hello,

    I've made some "interesting" experiences with a Java programm that
    uses a high number of threads in respect to the memory requirement but
    can't explain what's going on. Maybe someone other can shed some light
    on this issue.

    Currently I'm using the SUN JDK 1.5b2 on a linux 2.6 box. And YES: It
    has all settings set (ulimit, kernel, etc.) to enable any user process
    to launch up to 8000 threads/processes.

    My program runs in one configuration with some 1500 threads. It uses
    ~750MB at peak. So I start the JVM with addition "-server -Xmx1G
    -Xms1G" arguments which runs fine.
    With another internal configuration the number of threads increased
    upon start to 1800 and after creating _most_ of the threads the JVM
    reported an out of memory error and crashed the Java program -
    everthing upon start as I create all threads right at this point.
    I tried to increase the memory using "-Xmx1500m -Xms1500m" setting but
    now it got even worse: The JVM refused to create more then some 740
    threads. Yikes! That was not, was I was expecting from increasing the
    memory.
    More astonishing: I reduced the memory to "-Xmx900m" and now it
    started with 1800 threads.

    VERY puzzling...This leaves me with a couple of unaswered questions:

    1) What setting must I use to increase the memory to >1G and still be
    able to launch >1800 threads? (It might happen now, that the 900M
    isn't enough for the 1800 threads after some time).

    2) What's the initial memory a thread consumes from main memory upon
    creation?

    3) Why does the number of threads increase when I decrease the memory?


    Thanks a lot,
    Soeren Gerlach
    Soeren Gerlach, Jul 15, 2004
    #1
    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. Giovanni Bajo

    Python 2.5b2 Windows binaries

    Giovanni Bajo, Jul 18, 2006, in forum: Python
    Replies:
    0
    Views:
    898
    Giovanni Bajo
    Jul 18, 2006
  2. Larry Bates

    Python 2.5b2 and excepthook problem

    Larry Bates, Aug 7, 2006, in forum: Python
    Replies:
    0
    Views:
    307
    Larry Bates
    Aug 7, 2006
  3. Xabi
    Replies:
    0
    Views:
    758
  4. with respect to the memory

    , May 23, 2007, in forum: C Programming
    Replies:
    5
    Views:
    343
    Bart van Ingen Schenau
    May 29, 2007
  5. Crouchez

    Get number of threads in JVM

    Crouchez, Sep 1, 2007, in forum: Java
    Replies:
    10
    Views:
    8,217
Loading...

Share This Page