Find the answer to your Linux question:
Results 1 to 7 of 7
Hi All, greetings I am using Centos, in that i am executing normal stand alone java programs. Some time i am getting "java.lang.outofmemory heap space" error. how to increase the ...
  1. #1
    Just Joined!
    Join Date
    Apr 2011
    Posts
    1

    Java Memory Error

    Hi All,

    greetings

    I am using Centos, in that i am executing normal stand alone java programs. Some time i am getting "java.lang.outofmemory heap space" error. how to increase the heap size. I tried with the command java -Xms256m -Xmx1024m but its not working for me.Please help me.

    Thanks in advance

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Have you tried increasing your ulimit settings?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined! hunter_thom's Avatar
    Join Date
    Apr 2010
    Posts
    89
    Might try running jconsole from the shell and connecting to the process, to see what's eating all of the heap space.

    When you say it isnt working, do you mean that Java isn't reserving the heap space according to your JVM parameters, or do you mean that you still get OOM errors?

  4. #4
    Just Joined!
    Join Date
    Feb 2011
    Posts
    19
    is magic draw one of the programs you're running?

  5. #5
    Just Joined!
    Join Date
    Jan 2010
    Posts
    9

    solution

    Create a file named:launch.ini. with the content

    # set maximum Java heap size

    # maxheap=700m

    # additional args to pass to Java

    # java_args=-Dfoo -Dbar

    # additional args to pass to Maple

    # maple_args=-q

    # popup dialog showing the startup command (for debugging)

    # showcmd=true

    # enable the Java access bridge (accessibility)

    # jaccess=true

    # disable directX

    # java2d_nodraw=true

    # set default browser

    # browser="c:/Netscape"

  6. #6
    Just Joined! hunter_thom's Avatar
    Join Date
    Apr 2010
    Posts
    89
    danny - Where would the OP put that file? You don't mention.

    The OP's use of JVM parameters (java -Xms256m -Xmx1024m) is accurate for setting the minimum and maximum heap size.

    If you are getting PermGen space errors, then you'd want to pass a higher PermGen space value (done by: -XX:MaxPermSize=512m with the Sun JVM), but the OP mentioned heap space, and the heap space parameters are correct.

    OP - Did you modify any garbage collection settings? Have you tried connecting jconsole in order to see where all your memory is going? From within jconsole, you can also initiate a garbage collection. You may want to initiate a GC to see if the OOM errors go away or not.

  7. #7
    Just Joined!
    Join Date
    Jan 2010
    Posts
    9

    java

    You have to put the file where the .jar is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...