How to get jvm heap size?

Hi All,
I would like to get the jvm heap size.
by which method to get jvm heap size?
Where it can be executed?
Thanks,

You can get this:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html#freeMemory()

Similar Messages

  • How to increase JVM Heap Size

    Hi all,
    Our Environment
    ===============
    OS - Windows XP Service Pack 3
    Oracle Developer Suite - 10.1.2.3.0
    Oracle Forms & Reports Service 10.1.2.3.0
    Oracle Database 10.2.0.1.0
    JDK 1.5
    Jinitiator 1.3.1.30
    Apache POI 3.5
    From forms we are writing to excel files after copying XL template using Apache POI 3.5 and JDK 1.5. This XL template file has got lot of macros.
    We have imported the Java class files into form as pl/sql library. We are able to write upto 7Mb size of XL file. Beyond that size it comes with the error Ora-105101.
    We tried to increase the JVM Heap Size to 640M by setting values -Xmx640M everywhere in OC4J_BI_FORMS/Server Properties/Java Options, Home/Server Properties/Java Options through Enterprise Manager console. Also manually set the values in OPMN.XML and reloaded the same. Also set -Xmx640M in Jinitiator 1.3.1.30 Java Runtime Parameters. Also set in Java console. All settings have no effect.
    We have written a small program to display the run time memory from forms, which displays only maximum memory 63M all the time.
    PACKAGE BODY HeapSize IS
    -- DO NOT EDIT THIS FILE - it is machine generated!
    args JNI.ARGLIST;
    -- Constructor for signature ()V
    FUNCTION new RETURN ORA_JAVA.JOBJECT IS
    BEGIN
    args := NULL;
    RETURN (JNI.NEW_OBJECT('HeapSize', '()V', args));
    END;
    -- Method: getTotalMemory ()D
    FUNCTION getTotalMemory(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
    BEGIN
    args := NULL;
    RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'HeapSize', 'getTotalMemory', '()D', args);
    END;
    -- Method: getMaxMemory ()D
    FUNCTION getMaxMemory(
    obj ORA_JAVA.JOBJECT) RETURN NUMBER IS
    BEGIN
    args := NULL;
    RETURN JNI.CALL_DOUBLE_METHOD(FALSE, obj, 'HeapSize', 'getMaxMemory', '()D', args);
    END;
    BEGIN
    NULL;
    END;
    declare
    obj ORA_JAVA.JOBJECT;
    BEGIN
    obj:=HeapSize.new;
    message('Total memory '||HeapSize.getTotalMemory(obj));
    message('Max memory '||HeapSize.getMaxMemory(obj));
    END;
    Below procedure is for writing to Excel file.
    ============================================
    PACKAGE BODY UWWriteExcel IS
    -- DO NOT EDIT THIS FILE - it is machine generated!
    args JNI.ARGLIST;
    -- Constructor for signature ()V
    FUNCTION new RETURN ORA_JAVA.JOBJECT IS
    BEGIN
    args := NULL;
    RETURN (JNI.NEW_OBJECT('UWWriteExcel', '()V', args));
    END;
    -- Method: copyExcel (Ljava/lang/String;Ljava/lang/String;)V
    PROCEDURE copyExcel(
    obj ORA_JAVA.JOBJECT,
    a0 VARCHAR2,
    a1 VARCHAR2) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(2);
    JNI.ADD_STRING_ARG(args, a0);
    JNI.ADD_STRING_ARG(args, a1);
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'copyExcel', '(Ljava/lang/String;Ljava/lang/String;)V', args);
    END;
    -- Method: getSpreadSheetPara (Ljava/lang/String;)V
    PROCEDURE getSpreadSheetPara(
    obj ORA_JAVA.JOBJECT,
    a0 VARCHAR2) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(1);
    JNI.ADD_STRING_ARG(args, a0);
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'getSpreadSheetPara', '(Ljava/lang/String;)V', args);
    END;
    -- Method: openSheet (I)V
    PROCEDURE openSheet(
    obj ORA_JAVA.JOBJECT,
    a0 NUMBER) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(1);
    JNI.ADD_INT_ARG(args, a0);
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'openSheet', '(I)V', args);
    END;
    -- Method: getCellValues (IID)V
    PROCEDURE getCellValues(
    obj ORA_JAVA.JOBJECT,
    a0 NUMBER,
    a1 NUMBER,
    a2 NUMBER) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(3);
    JNI.ADD_INT_ARG(args, a0);
    JNI.ADD_INT_ARG(args, a1);
    JNI.ADD_DOUBLE_ARG(args, a2);
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'getCellValues', '(IID)V', args);
    END;
    -- Method: getCellValues (IILjava/lang/String;)V
    PROCEDURE getCellValues(
    obj ORA_JAVA.JOBJECT,
    a0 NUMBER,
    a1 NUMBER,
    a2 VARCHAR2) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(3);
    JNI.ADD_INT_ARG(args, a0);
    JNI.ADD_INT_ARG(args, a1);
    JNI.ADD_STRING_ARG(args, a2);
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'getCellValues', '(IILjava/lang/String;)V', args);
    END;
    -- Method: exportExcel ()V
    PROCEDURE exportExcel(
    obj ORA_JAVA.JOBJECT) IS
    BEGIN
    args := NULL;
    JNI.CALL_VOID_METHOD(FALSE, obj, 'UWWriteExcel', 'exportExcel', '()V', args);
    END;
    -- Method: copy (Ljava/lang/String;Ljava/lang/String;)V
    PROCEDURE copy(
    a0 VARCHAR2,
    a1 VARCHAR2) IS
    BEGIN
    args := JNI.CREATE_ARG_LIST(2);
    JNI.ADD_STRING_ARG(args, a0);
    JNI.ADD_STRING_ARG(args, a1);
    JNI.CALL_VOID_METHOD(TRUE, NULL, 'UWWriteExcel', 'copy', '(Ljava/lang/String;Ljava/lang/String;)V', args);
    END;
    BEGIN
    NULL;
    END;
    declare
    obj ORA_JAVA.JOBJECT;
    BEGIN
    message('-1');pause;
    obj:=UWWriteExcel.new;
    message('0');pause;
    UWWriteExcel.copyExcel(obj,'C:\\excel\\CAT2009WS.XLS','C:\\excel\\CAT2009WS.XLS');
    message('1');pause;
    UWWriteExcel.openSheet(obj,0);
    message('2');pause;
    UWWriteExcel.getCellValues(obj,6,2,900);
    message('3');pause;
    UWWriteExcel.getCellValues(obj,7,2,911);
    message('4');pause;
    UWWriteExcel.exportExcel(obj);
    END;
    When the size of XL is more than 7Mb, after message(0) it will be display oracle error.
    From command prompt if we run the same java class file by passing -Xmx256m parameter we are able to write to big XL file.
    Can anyone tell me where I am wrong... Can we increase the JVM Heap Size from forms...

    I have a simular problem.
    Via Forms I call a Java class (import Java class -> PL/SQL class java method).
    For this specific process I need to set the Xmx java option...
    How do I do this ?
    Changing the java option for the Forms-OC4J in the EM doesn't help.
    Is there an other level where I can modify this ?
    Does the java process of the forms is the single process that exists ? How does he handles such java calls?
    Are that separed java processes ? threads ? ....
    Thanks !!!

  • How to set the heap size of JVM

    please let me know that how to set the heap size of JVM

    C:\>java -X
        -Xmixed           mixed mode execution (default)
        -Xint             interpreted mode execution only
        -Xbootclasspath:<directories and zip/jar files separated by ;>
                          set search path for bootstrap classes and resources
        -Xbootclasspath/a:<directories and zip/jar files separated by ;>
                          append to end of bootstrap class path
        -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                          prepend in front of bootstrap class path
        -Xnoclassgc       disable class garbage collection
        -Xincgc           enable incremental garbage collection
        -Xbatch           disable background compilation
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap size
        -Xss<size>        set java thread stack size
        -Xprof            output cpu profiling data
        -Xrunhprof[:help]|[:<option>=<value>, ...]
                          perform JVMPI heap, cpu, or monitor profiling
        -Xdebug           enable remote debugging
        -Xfuture          enable strictest checks, anticipating future default
        -Xrs              reduce use of OS signals by Java/VM (see documentation)look at the -Xm? lines
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap sizeThis can be used e.g. like this:java -Xms8M -Xmx32M MyProgwhich runs MyProg in a java VM with the initial heap size of 8 MB and a maximum heap size of 32 MB.
    - Marcus

  • How to increase the heap size of the container in whioch BPEL is running ?

    Hi All,
    I recently raised an SR they have asked me to do the following,
    Can you please try and start the container running the BPEL process with max
    heap space (-Xmx) of 2 GB and the eden space (-Xmn) at about 60% of 1228m and
    the option -XX:+AggressiveHeap set. (even though this option is recommended for
    multi processor machines say 4)
    can anyone kindly explain me how to increase the Heap size and Eden size of BPEL container ?
    Thank You

    Hi Deepak I cant see any attribute or element in the oc4j_opmn.xml file regarding heap memory. In the server properties I changed the size of heap memeory how can I rollback.
    I am getting the following error
    Configuration information
    Running in C:\product\10.1.3.1\OracleAS_1
    Operation mode:Startup, App Server, No Enterprise Manager, Single Instance
    Oracle home:C:\product\10.1.3.1\OracleAS_1
    Oracle home name:Unnamed
    Instance name:SOA.01hw117905.India.TCS.com
    Instance type:allProducts
    Version:10.1.3.4.0
    Uses infrastructure:false
    Not an infrastructure instance, no infrastructure information available
    Components:[j2ee, apache, orabpel, oraesb, owsm, Wsil]
    2009-08-19 09:08:51.863--Begin log output for Mid-tier services (SOA.01hw117905.India.TCS.com)
    2009-08-19 09:08:51.863--Processing Step: starting OPMN
    2009-08-19 09:09:00.394--Processing Step: starting OPMN managed processes
    2009-08-19 09:09:35.19--End log output for Mid-tier services (SOA.01hw117905.India.TCS.com)
    An unknown OPMN error has occured
    oracle.appserver.startupconsole.model.ConsoleException: An unknown OPMN error has occured
         at oracle.appserver.startupconsole.control.OPMNController.doStart(OPMNController.java:121)
         at oracle.appserver.startupconsole.control.Controller.start(Controller.java:69)
         at oracle.appserver.startupconsole.control.GroupController.doStart(GroupController.java:47)
         at oracle.appserver.startupconsole.control.Controller.start(Controller.java:69)
         at oracle.appserver.startupconsole.view.controller.ControllerAdapter.start(ControllerAdapter.java:30)
         at oracle.appserver.startupconsole.view.controller.MasterControlAdapter.run(MasterControlAdapter.java:94)
         at oracle.appserver.startupconsole.view.Runner.main(Runner.java:39)
    Caused by: oracle.ias.opmn.optic.OpticControlException: Error from opmn during process control operation
         at oracle.ias.opmn.optic.AbstractOpmnEntity.runCommand(AbstractOpmnEntity.java:174)
         at oracle.ias.opmn.optic.AbstractOpmnEntity.start(AbstractOpmnEntity.java:110)
         at oracle.appserver.startupconsole.control.OPMNController.doStart(OPMNController.java:89)
         ... 6 more
    Exception caused by
    Error from opmn during process control operation
    oracle.ias.opmn.optic.OpticControlException: Error from opmn during process control operation
         at oracle.ias.opmn.optic.AbstractOpmnEntity.runCommand(AbstractOpmnEntity.java:174)
         at oracle.ias.opmn.optic.AbstractOpmnEntity.start(AbstractOpmnEntity.java:110)
         at oracle.appserver.startupconsole.control.OPMNController.doStart(OPMNController.java:89)
         at oracle.appserver.startupconsole.control.Controller.start(Controller.java:69)
         at oracle.appserver.startupconsole.control.GroupController.doStart(GroupController.java:47)
         at oracle.appserver.startupconsole.control.Controller.start(Controller.java:69)
         at oracle.appserver.startupconsole.view.controller.ControllerAdapter.start(ControllerAdapter.java:30)
         at oracle.appserver.startupconsole.view.controller.MasterControlAdapter.run(MasterControlAdapter.java:94)
         at oracle.appserver.startupconsole.view.Runner.main(Runner.java:39)
    <?xml version='1.0' encoding='WINDOWS-1252'?>
    <response>
    <msg code="-82" text="Remote request with weak authentication.">
    </msg>
    <opmn id="01hw117905:6200" http-status="206" http-response="2 of 3 processes started.">
    <ias-instance id="SOA.01hw117905.India.TCS.com">
    <ias-component id="default_group">
    <process-type id="home">
    <process-set id="default_group">
    <process id="172" pid="2176" status="Alive" index="1" log="C:\product\10.1.3.1\OracleAS_1\opmn\logs\\default_group~home~default_group~1.log" operation="request" result="success">
    <msg code="0" text="">
    </msg>
    </process>
    </process-set>
    </process-type>
    <process-type id="oc4j_soa">
    <process-set id="default_group">
    <process id="173" pid="5556" status="Stopped" index="1" log="C:\product\10.1.3.1\OracleAS_1\opmn\logs\\default_group~oc4j_soa~default_group~1.log" operation="request" result="failure">
    <msg code="-21" text="failed to start a managed process after the maximum retry limit">
    </msg>
    </process>
    </process-set>
    </process-type>
    </ias-component>
    <ias-component id="HTTP_Server">
    <process-type id="HTTP_Server">
    <process-set id="HTTP_Server">
    <process id="171" pid="2724" status="Alive" index="1" log="C:\product\10.1.3.1\OracleAS_1\opmn\logs\\HTTP_Server~1.log" operation="request" result="success">
    <msg code="0" text="">
    </msg>
    </process>
    </process-set>
    </process-type>
    </ias-component>
    </ias-instance>
    </opmn>
    </response>

  • Change your JVM heap size

    Can you please let me know how to increase the JVM Heap Size -- on linux fedora 6.0.
    Thank you,

    See -Xmx
    http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html

  • Forms Server JVM Heap Size

    Hi,
    Is it possible to change the java importer JVM Heap size on the Forms server in 9iR2?
    Currently, I get a java.lang.OutOfMemory exception when trying to run some imported Java on the server through my form.
    Thanks in advance,
    Ian

    We are looking into adding the ability to specify the heap size of the JVM when you use the Java Importer. It can't be done right now.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • How to get the file size (in bytes) for all files in a directory?

    How to get the file size (in bytes) for all files in a directory?
    The following code does not work. isFile() does NOT recognize files as files but only as directories. Why?
    Furthermore the size is not retrieved correctly.
    How do I have to code it otherwise? Is there a way of not converting f-to-string-to-File again but iterate over all file objects instead?
    Thank you
    Peter
    java.io.File f = new java.io.File("D:/todo/");
    files = f.list();
    for (int i = 0; i < files.length; i++) {
    System.out.println("fn=" + files);
    if (new File(files[i]).isFile())
         System.out.println("file[" + i + "]=" + files[i] + " size=" + (new File(files[i])).length() ); }

    pstein wrote:
    ...The following code does not work. Work?! It does not even compile! Please consider posting code in the form of an SSCCE in future.
    Here is an SSCCE.
    import java.io.File;
    class ListFiles {
        public static void main(String[] args) {
            java.io.File f = new java.io.File("/media/disk");
            // provides only the file names, not the path/name!
            //String[] files = f.list();
            File[] files = f.listFiles();
            for (int i = 0; i < files.length; i++) {
                System.out.println("fn=" + files);
    if (files[i].isFile()) {
    System.out.println(
    "file[" +
    i +
    "]=" +
    files[i] +
    " size=" +
    (files[i]).length() );
    }Edit 1:
    Also, in future, when posting code, code snippets, HTML/XML or input/output, please use the code tags to retain the indentation and formatting.   To do that, select the code and click the CODE button seen on the Plain Text tab of the message posting form.  It took me longer to clean up that code and turn it into an SSCCE, than it took to +solve the problem.+
    Edited by: AndrewThompson64 on Jul 21, 2009 8:47 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the correct size of the loaded swf file?

    final public class main extends Sprite
      public function main()
       loaderInfo.addEventListener(Event.COMPLETE, _onLoadCompleted);
      private function _onLoadCompleted(event: Event): void
       var tw: int = stage.width;
       var th: int = stage.height;
       var tsw: int = stage.stageWidth;
       var tsh: int = stage.stageHeight;   
    Above is my simple as3 project in flex builder 3.
    My screen resolution is 1920*1080, when debugging, the swf is stretched to the full client area of the IE, but the stage.stageWidth is 500 and the stage.stageHeight is 375, both the stage.widht and stage.height are 0, who can tell me why and how to get the right size of the swf file, named the client area size of the IE in this situation?
    Thanks very much!

    The HTML wrapper might resize the SWF later, so wait a frame and check stageWidth/stageHeight again.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How to get the byte[] size dynamically from the StreamMessage object

    Hi all,
    Using JMS, I am receiving the FDF file as StreamMessage from the queue and attaching it to the PDF file which is present in the local system.
    For that, I have written the code as follows:
    {color:#0000ff} Message msg = jmsTemplate.receive();
    if(msg !=null && msg instanceof StreamMessage)
    StreamMessage message = (StreamMessage) msg;{color}
    {color:#ff6600}//hardcoded the byte array size value
    {color}{color:#0000ff} byte[] bytes = new byte[{color:#ff0000}856{color}];
    System.out.println("read msg="+message.readBytes(bytes));{color}
    {color:#0000ff}PdfReader pdfreader = new PdfReader("D:\\Managing_Workflows_No_Comment.pdf");
    PdfStamper stamp = new PdfStamper(pdfreader, new FileOutputStream("D:\\12345.pdf"));
    FdfReader fdfreader = new FdfReader(bytes);
    stamp.addComments(fdfreader);
    {color} {color:#0000ff} stamp.close();
    {color}{color:#000000}The above code is working fine except with the hardcoded of {color:#ff0000}byte array{color}{color:#ff0000} size value{color} which is given in {color:#ff0000}RED{color} in color.
    Can anybody know, {color:#000000}*how to get the byte[] size dynamically from the StreamMessage*{color} object ?
    Any help would be highly beneficial for me !!!!
    Thanks and Regards,
    Ganesh Kumar{color}

    When you create your stream message you could add an property to your message, something like streamSize that would contain the number of bytes in your stream message. Then you could get this property from the message before declaring your array.
    Tom

  • Does Solaris10 for x86 allow me to set java jvm heap size up to 3G

    Does Solaris10 for x86 allow me to set java jvm heap size up to 3G,is it really true solaris only take 512M memory address space?I can only set 2668M(2.5G)on linux cause linux kernel take 1G memory address space.Thanks~~

    [url http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html]Runtime seems to have some useful methods...

  • Large JVM heap sizes under windows xp?

    I have a windows XP Pro SP1 box with 2 GB of physical RAM. I am using the latest jdk, 1.4.2_05.
    I understand that 32 bit windows by default allows 2 GB address space for each application, permanently reserving 2 GB for the OS. (There are also apparently special builds going back to win2k which have a special mode where applications can address 3 GB and the OS addresses 1 GB; if anyone knows how to turn this mode on under win xp please let me know.)
    So, I should be able to allocate ~2 GB to the JVM (the number is slightly less than 2 GB due to overhead associated with each process in windows) using something like
         -Xms1900m -Xmx1900m
    as command line args to the java command.
    But when I try the above it crashes with the error
         Error occurred during initialization of VM
         Could not reserve enough space for object heap
    Experimentally, I found that the maximum value which works on my box is
         -Xms1200m -Xmx1200m
    which seems way smaller than it ought to be.
    Doing a forum search, I found others who report similar issues, e.g.
         http://forum.java.sun.com/thread.jsp?forum=136&thread=522506
    But I did not find a decent solution or up to date discusssion.
    Does anyone know with windows xp pro what the jvm memory limit is?
    As part of my sun search, I came across the following old (circa 2000) but interesting bug report:
         http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4358809
    I have never heard of the rebase program before. Is it built into windows? Is it safe to use? Anyone ever try the command as described there?

    In addition to this forum posting, I got in email communication with Peter Kessler, the technical lead for the garbage collector in the HotSpot(TM) virtual machine). Below are snippets from some of his emails to me.
    #1:
    I haven't tried pushing Windohs XP to see how big I could get the
    heap. I'm pretty sure you don't want to get try to get it to 1.9GB,
    since that wouldn't leave much room for DLL's, JVM data structures
    outside the heap, thread stacks, I/O buffers, etc.
    I don't know what the library C:\WINDOWS\System32\LPK.DLL is, or if
    you could successfully rebase it closer to 0x76000000. The issue
    with rebasing DLL's is that people have sometimes given thought to
    where they should be, given other libraries they are typically used
    with. (If a DLL can't be loaded at its default base address, it
    gets relocated dynamically. That slows down program startup; and
    often means that the library can't be shared with other applications
    running on the same machine, increasing your need for swap file
    space.)
    It does seem weird that we would make the default base for jvm.dll
    be 0x08000000, but the base of hpi.dll at 0x10000000. [See email #3 below]
    The jvm.dll isn't going to get that much larger any time soon. I'll ask around
    about that one. (The library bases for JDK-1.4.2 are different
    from those reported in bug id 4358809 for because we periodically
    reconsider where to base the libraries, given the other libraries
    on a particular release of Windohs.)
    So, I don't have any great advice on how to squeeze another 400MB of
    heap out of your machine. I suppose it's fruitless to ask if you
    could squeeze 400MB of data structures out of your application?
    Have you run an allocation profiler on it?
    Since you are willing to switch operating systems, you can download
    a copy of Solaris 10 for x86 platforms (for free) from
    http://wwws.sun.com/software/solaris/10/
    I just tried a Solaris 10 x86 box, and could get a -Xmx2900m jvm to
    start. But without your application it's hard to know if it would
    run well with that size heap (e.g., if it would have room for thread
    stacks, file buffers, etc.), so your milage may vary, but 2.9GB is
    larger than you say you need. There are lots of other benefits of
    running Solaris. I don't know about making you a poster child, but
    I could ask about that, too.
    #2:
    I'm told that some of the popular distibutions of Linux ship with
    a "4GB" kernel, which allows one to get 3GB (2.4 kernels?) or almost
    4GB (2.6 kernels?) of address space for user processes. I haven't
    used those kernels myself. Among the reasons the 4GB kernel isn't
    the standard kernel is that some user programs are surprised (in a
    bad way) by finding their code or data in the "negative" part of
    the address space, or crossing the "sign-bit" boundary. (Of course,
    all addressing arithmetic should be done as unsigned quantities!)
    Our Java virtual machine shouldn't have those problems, so that
    kernel might work for you.
    #3:
    Ah. It looks like in JDK-1.4.2 (and earlier) we forgot to
    explicitly set the base for hpi.dll, so it got the default
    base of 0x10000000. (Don't we love learning these details
    about Windohs?) As I said, we periodically reconsider the
    bases for the libraries. We seem to have done that, more
    thoroughly, for JDK-1.5.0:
    Base Size Version Path
    0x00400000 0xc000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\bin\java.EXE
    0x77f80000 0x7d000 5.00.2195.6899 C:\WINNT\system32\ntdll.dll
    0x7c2d0000 0x62000 5.00.2195.6876 C:\WINNT\system32\ADVAPI32.dll
    0x7c570000 0xb8000 5.00.2195.6897 C:\WINNT\system32\KERNEL32.DLL
    0x77d30000 0x71000 5.00.2195.6904 C:\WINNT\system32\RPCRT4.DLL
    0x78000000 0x45000 6.01.9844.0000 C:\WINNT\system32\MSVCRT.dll
    0x6d6b0000 0x185000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\jre\bin\client\jvm.dll
    0x77e10000 0x65000 5.00.2195.6897 C:\WINNT\system32\USER32.dll
    0x77f40000 0x3e000 5.00.2195.6898 C:\WINNT\system32\GDI32.DLL
    0x77570000 0x30000 5.00.2161.0001 C:\WINNT\system32\WINMM.dll
    0x6d2f0000 0x8000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\jre\bin\hpi.dll
    0x690a0000 0xb000 5.00.2134.0001 C:\WINNT\system32\PSAPI.DLL
    0x6d680000 0xc000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\jre\bin\verify.dll
    0x6d370000 0x1d000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\jre\bin\java.dll
    0x6d6a0000 0xf000 1.05.0000.0000 C:\pbk\deployed\JDK-1.5.0\jre\bin\zip.dll
    You might want to try the "release candidate" (i.e., what we
    hope will be the final bits) of JDK-1.5.0 from
    http://java.sun.com/j2se/1.5.0/download.jsp
    and see if it helps.

  • Safely reducing JVM heap sizes

    I have just started to rewrite a physics multi-particle simulation program in Java. The program is supposed to have a light, essentially constant memory footprint throughout the execution of the simulation. While I am aware of that switching from legacy procedural code to a clean OO design will cause a very significant increase in memory consumption (let alone any language implementation issues) it was a bit jarring to see the process running my first working prototype consumed ~64MB while serializing the simulation framework object (which contains references to everything else in the program) results in a 115KB file. I asked Google for help and it told me about the -Xmx switch which sets the maximum heap size reserved by the JVM. A very brief test indicates it can really help, as -Xmx16m brought memory uptake to a much saner ~18MB. However, I have a few concerns about this kind of tuning; namely, stability over long execution times (I mean several days potentially), performance issues due to garbage collection problems and the need to accommodate for the growth of the program (as it is only a very basic prototype right now). So I would like to ask for advice on good practices and, eventually, useful tools (profilers, etc.) to identify potential problems. Thanks in advance!
    P.S.: If any of you is thinking "just use C++, then!", that's my ultimate goal. But before that I need to become more fluent in that language in order to avoid unnecessary suffering with memory leaks and the like. I believe porting to C++ later on will be a lot easier if have the design done in Java, and having a functional program with decent performance in the meantime would help a lot. Furthermore, I like Java, and it would be nice to see it doing scientific computing :-)

    @paulcw: Thanks for the useful advice, I will definitely consider these options. Right now, my main problem is that I'm a very inexperienced programmer, and Java is the language I feel more able to produce a solid design with. On the other hand now I have another reason to have a good look at Python... about the C++ issue, I think I will have to do the switch at some point; not necessarily due to performance issues but also because I would like to be able to run the program in systems in which I won't have the luxury of, say, a JVM available. But you're probably right in that I should start porting while the program is still small and simple, even if I need to learn a lot of C++ skills in the process...
    sjasja wrote:
    While I am aware of that switching from legacy procedural code to a clean OO design will cause a very significant increase in memory consumptionI'm not sure there is such a rule. An int is 32 bits in C and in Java. A pointer is 32 bits in both (or 64 on a 64-bit system). A Java object has an object header (Sun JVM: 8 bytes on a 32-bit system), when you malloc() a struct in C it typically has 4 or 8 bytes of malloc header; ditto for new in C++.
    It is possible to be wasteful of memory in any language or any programming style. Just don't do that then.
    Indeed. It is shocking how much prejudice people have about such issues, as I demonstrated in my post. In fact, I found that my first Java build ran remarkably fast considering I feared at first that it would be maybe one order of magnitude slower than our legacy code. (By the way, said legacy code is not aggressively optimized. There are some very fast packages available for the calculations we run, but more often than not we prefer sticking to our "amateur" in-house developed tools for simplicity of operation and for having full control on what the program does, or which features we might want to add. The problem is that such an approach does not work well when you spend half your productive time fighting with messy FORTRAN code)
    my first working prototype consumed ~64MBHow do you determine that?
    Tools like top on Unix or task manager on Windows are not reliable measures of memory use. Take this C program:
    main() { sleep(60); }According to Windows Task Manager that takes 1.2 megabytes of memory to execute. In reality it doesn't: most of that memory is the C runtime dll that is mapped into memory. Most of the runtime is never touched by the program; most of it is never brought from disk to RAM. But because it is mapped into memory, ready to be used, Task Manager reports it. Even if the library is used, several processes share the same memory mapped copy; memory use as reported by simple tools can far exceed available memory, as the same libraries are counted again and again for many processes.
    You get a similar effect with the Java runtime. There are lots of stuff in there, like graphics libraries, networking, etc etc that is in the runtime dll and jars. Those are memory mapped but never touched; and tools that report memory usage are likely to mislead the careless observer.Newbie question: what would be a good way, then, to monitor actual RAM consumption - either using Java features or Linux commands?

  • How to increase JVM Process size for WebLogic running SOA Applications.

    Hi,
    I believe 32 Bit OS can address up to 4GB memory so theoretically 32 Bit JVM can use 4GB but practical convention is 2GB as other 2GB is used by OS itself and also this default JVM Process size is set somewhere and I also believe that if JVM is 32 bit on 64Bit OS even though JVM will run on 32Bit Virtual Machine so JVM does not know that it is 64Bit OS in that case again it can use max Process default size up to 2GB.
    And for 64Bit JVM, I can allocate more than 4GB depend on my available RAM size to Xmx, MaxPermSize parameters in java.exe file and after that I can set the same value in “setSOADomainEnv.cmd” or to “setDomainEnv.cmd” file.
    But I am 99% sure by just assigning more memory value to Xmx, MaxPermSize in “setSOADomainEnv.cmd” file only won’t work (not setting Xmx in java.exe), if it would have worked then in my case when I was assigning 1536 to Xmx in “setSOADomainEnv.cmd” file then why it was showing out of memory error. I think that is because it was only taking default 2GB for my 32 Bit JVM not considering 3GB or 4GB. So i think i have to change default memory size what JVM can use (<http://www.wikihow.com/Increase-Java-Memory-in-Windows-7> but i am using windows 8 so for that I don’t know the option to change this default Process Size)
    I also believe that first JVM start and before start it check how much memory it can use from it’s own –Xmx parameter in some ware configuration or java.exe file and after that it allocate that much size of JVM Process Memory in RAM then after it loads Weblogic or Java Applications in its (Heap + Non-heap + Native Area) which are parts of JVM Process memory
    I read post on :< http://stackoverflow.com/questions/3143579/how-can-jvm-use-more-than-4gb-of-memory > and < http://alvinalexander.com/blog/post/java/java-xmx-xms-memory-heap-size-control >
    All used  : 
    java -Xmx64m -classpath ".:${THE_CLASSPATH}" ${PROGRAM_NAME}
    java –Xmx6g     //command which will call java/JVM interpreter which will hold –Xmx parameter to set Heap size for JVM
                                    before JVM comes in memory (JVM process memory)
    now my question is can I manually open any configuration file or java.exe same like “setSOADomainEnv.cmd” or “setDomainEnv.cmd” (I know since java.exe is exe I can’t open simply but I want similar work around)
    so that I don’t need to type java –Xmx6g every time when I run weblogic (and then later I can change weblogic “setDomainEnv.cmd” Xmx and PermSize to more than default size 4GB to 5GB or 6GB in the case of 64Bit OS)
    Please correct me if I am wrong in my understanding.
    Thanks.

    These days the VM will detect a "server" machine and set up the memory appropriate for that.
    You can create a simple java console application and have it print the memory settings (find the appropriate java class fort that.)
    There is of course the possibility that your application is running out of memory because it is doing something wrong and not because the VM doesn't have enough memory.  You can force that in a test setup by LOWERING the maximum amount of memory and thus making it more likely that an out of memory exception will occur.

  • JVM Heap size Vs Heap Used

    I will begin my question with an example.
    I have an app. with 18MB heap used & 31 MB Heap Size. With stress testing the heap used occasionally goes to 19 MB. But if it goes the heap size increases by 1 MB to 19MB. The moment the job is done, the heap used comes back to 18MB but not the total heap size.
    My guess (???) is that, once the heap size increases, there is no way with the jvm to get is shrunk.
    Am I right ?
    Cheers
    Venkat

    Modern jvms may return memory. But they are normally reluctant to do so.
    You can not force the jvm to shrink, the jvm decides when it does so.
    /robo

  • JVM Heap size settings

    I am unbale to find the JVM heap settings.Could you please me where the heap size was defined?

    886340 wrote:
    With reference to Java WebStart.
    sigh
    - I open google
    - I type in "java webstart set heap". Click search
    - first hit: the webstart faq
    http://download.oracle.com/javase/1,5.0/docs/guide/javaws/developersguide/faq.html
    - I search for "heap" using the browser search function
    - I feel superior for finding the answer that quickly and easily
    It makes me sad when people don't want to help themselves to live an easier and more rewarding development life. All it takes is the will to learn how to find information yourself :(

Maybe you are looking for

  • Outgoing email completely lost (Mail app with Gmail account) - Insanely awkward

    This is gonna be hard to explain as I have no "evidence" but here's what happened for the 3rd time now in the last 2-3 months on Yosemite using a Gmail account from Mail app. I write a mail (either reply or new one), send it and it get's completely l

  • How to find user exits for a specific field

    hi,     How can we find a user exit for a specific fields . as i know Three ways to search user-exits 1. SE80 look includes in a packages with name user-exits 2.  by zreport which will fetch user-exit in a T-CODE 3. SMOD but what if we have to find a

  • Can I use Bridge to view files in Google Drive?

    Is there any way to use Bridge to view files that are in a shared Google Drive folder?

  • Wwv_flow.accept, error 404 page not found

    I am trying to install the OEHR Sample Objects for the Hosted Demo environment at apex.oracle.com site so I can do the Oracle Application Express 2 Day + Tutorial. I downloaded the zip file and got the .sql file extracted ok. The import works ok for

  • Wanted: App to update Skyhook database

    I live in a small city with almost no Skyhook coverage. It's not that big of a deal because it's not a large city and I always know where I am, but I'd still like to play with the new location-based applications that are coming out. My wish is to fin