Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default get maximum heap size that can be allocated

    Hi

    is there a way by which i can progmatically find the current maximum amount of system heap memory that can be allocated by a JVM.

    Or if i am writing a simple java code and want to know what's the current SYSTEM max heap memory,


    Thanks

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    What do you mean by system heap memory?
    The heap is used by your java application not by your OS.

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    what i meant was... for eg.

    if i run

    java -Xms64m -Xmx512m -jar xyz.jar (it runs)

    else

    java -Xms64m -Xmx2000m -jar xyz.jar (it fails, sayin "Failed to instantiate heap. 2000M requested. Could not create the Java virtual machine.)

    is there a way by which i can progmatically know the maximum heap that can be allocated.
    Last edited by gautam.aditya97; 03-30-2010 at 08:29 AM.

  4. #4
    amp88 is offline Member
    Join Date
    Apr 2010
    Posts
    3
    Rep Power
    0

    Default

    The Runtime class provides some information on this. See here for a bit more information on Runtime and other ways to assess memory usage more accurately.

Similar Threads

  1. Maximum size of POST to Servlet
    By Ward in forum Java Servlet
    Replies: 0
    Last Post: 03-04-2009, 12:35 PM
  2. Java heap size
    By jmdrocks in forum Eclipse
    Replies: 2
    Last Post: 12-12-2008, 07:10 AM
  3. Replies: 2
    Last Post: 08-21-2008, 07:33 PM
  4. Replies: 2
    Last Post: 07-03-2007, 04:09 PM
  5. Maximum size of an array
    By Hasan in forum New To Java
    Replies: 1
    Last Post: 05-20-2007, 11:11 AM

Posting Permissions

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