Monitor heap size

How do we monitor Java heap size? Is there any way to check whether we are exceeding the heap size or not?
Regards,
N.S

Hi Swamy
Start the NWA tool (NetWeaver Administrator) that can be reached from the main page of your J2EE.
Log on with a administrator user and select the "Monitoring" link.
Then you select the "Java System Reports" link.
Here you should see a graph showing your "Resource consumption
Reward suitable points

Similar Messages

  • How to monitor heap size used in OPP in order to protect Out of Memory

    My objective is to know how much heap size currently use so I can handle or do something before user got error report.
    The following sql statement just determine what the heap size per OPP process is currently setting:
    select DEVELOPER_PARAMETERS from FND_CP_SERVICES
    where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES
    where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
    Now OPP heap size is set to 1.5G.
    Thanks

    Hi Sam,
    Please review the following note, as it might help you!!!
    Tuning Output Post Processor (OPP) to Improve Performance (Doc ID 1399454.1)
    R12: How to Configure the Account Analysis Report for Large Reports (Doc ID 737311.1)
    Thanks &
    Best Regards,

  • How do we monitor Java heap size

    How do we monitor Java heap size? Is there any way to check whether we are exceeding the heap size or not?
    Regards,
    N.S

    Hi,
    > How do we monitor Java heap size? Is there any way to
    > check whether we are exceeding the heap size or not?
    >
    You should run your JAVA AS with the recommended settings described in the note
    "Java VM settings for J2EE 6.30/6.40/7.0"
    SAP Note Number: 723909.
    If you do so, you can find the garbage collector log messages in your dev_server* or your std_server*.out file.
    You can also use the option -Xloggc:<file> to log to a seperate file.
    You can visualize the GC log file with a tool like GCViewer.
    See
    http://www.javaperformancetuning.com/tools/gcviewer/index.shtml
    for an overview of this tool.
    Regards,
    Markus

  • 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

  • Memory Usage in WinTaskManger vs heap size

    hello,
    I have exactly the same problem as in the topic "Windows Task Manager vs. Heap", posted at Dec 10, 2004 5:17 AM, by jorgeHX.
    Here are the symptoms:
    1) My application starts at 20MB seen by windows task manager
    2) I use profiler to monitor the heap. Heap is always working very healthly - heap size in the profiler increases by a minimum until the gc comes around so that the used heap size drops down again.
    3) However, after doing a relatively memory-consuming operation (loop of String indexing, patterning ..etc.), the memory usage in windows task manager goes up couple of MBs but never drops down.
    4) Then I go manually free the heap (System.gc()), I can see GC is freeing heap. However, the memory in windows task manager remains no change, no matter how many times I force the garbabge collection.
    This is a bad thing - if my application keeps doing that memory-consuming operation again and again, the memory seen in the windows task manager will be growing and growing to hundreds of MBs until the windows alerts "low on virtual memory".
    I tried everything already. I set every instance = null at the end, I delete every reference but the memory just keeps increasing! WHY?????
    Anyone can help me charactorize the problem? I am so in dark!!
    Ryan-Chi

    I guess my problem can also be interpretated as
    "Why doesn't JVM return memory to OS?"
    It does, depending on the setting of the -XX:MaxHeapFreeRatio option. "Normal" operation using the default setting does not usually cause memory to be returned to the os.
    Search for this option term for explanations.

  • Where do i change the heap size?

    have the application installed and functional, most setup is complete.
    When i'm working with the application we have running on the app server, i am only able to work for around 30 minutes before heap errors prevent further use with the site.
    where do i change the allocated heap size?
    within the portal?
    on the server?
    Running Windows and Oracle App Server

    here is the file i have to work with....
    &lt;?xml version = '1.0' encoding = 'UTF-8'?&gt;
    &lt;opmn xmlns="http://www.oracle.com/ias-instance"&gt;
    &lt;log path="$ORACLE_HOME\opmn\logs\opmn.log" comp="internal;ons;pm" rotation-size="1500000"/&gt;
    &lt;debug path="$ORACLE_HOME\opmn\logs\opmn.dbg" comp="internal" rotation-size="1500000"/&gt;
    &lt;notification-server&gt;
    &lt;port local="6100" remote="6200" request="6003"/&gt;
    &lt;ssl enabled="true" wallet-file="$ORACLE_HOME\opmn\conf\ssl.wlt\default"/&gt;
    &lt;/notification-server&gt;
    &lt;process-manager&gt;
    &lt;process-modules&gt;
    &lt;module path="$ORACLE_HOME\opmn\lib\libopmnohs"&gt;
    &lt;module-id id="OHS"/&gt;
    &lt;/module&gt;
    &lt;module path="$ORACLE_HOME\opmn\lib\libopmnoc4j"&gt;
    &lt;module-id id="OC4J"/&gt;
    &lt;/module&gt;
    &lt;module path="$ORACLE_HOME\opmn\lib\libopmncustom"&gt;
    &lt;module-id id="CUSTOM"/&gt;
    &lt;/module&gt;
    &lt;module path="$ORACLE_HOME\opmn\lib\libopmniaspt"&gt;
    &lt;module-id id="IASPT"/&gt;
    &lt;/module&gt;
    &lt;/process-modules&gt;
    &lt;ias-instance id="detqas.ARC-MCAC-VW018.amc.faa.gov" name="detqas.ARC-MCAC-VW018.amc.faa.gov"&gt;
    &lt;environment&gt;
    &lt;variable id="TMP" value="C:\DOCUME~1\DENNIS~1\LOCALS~1\Temp"/&gt;
    &lt;/environment&gt;
    &lt;module-data&gt;
    &lt;category id="start-parameters"&gt;
    &lt;data id="routing-id" value="g_rt_id"/&gt;
    &lt;/category&gt;
    &lt;/module-data&gt;
    &lt;ias-component id="ASG" status="enabled" id-matching="true"&gt;
    &lt;process-type id="ASG" module-id="CUSTOM"&gt;
    &lt;environment&gt;
    &lt;variable id="OS" value="Windows_NT"/&gt;
    &lt;/environment&gt;
    &lt;start timeout="600"/&gt;
    &lt;stop timeout="120"/&gt;
    &lt;process-set id="ASG" numprocs="1"&gt;
    &lt;module-data&gt;
    &lt;category id="start-parameters"&gt;
    &lt;data id="start-executable" value="D:\product\10.1.3\OracleAS\jdk\bin\java"/&gt;
    &lt;data id="start-args" value="-ms20m -Djava.library.path=D:\product\10.1.3\OracleAS\bin;D:\product\10.1.3\OracleAS\dsa\bin;D:\product\10.1.3\OracleAS\oui\lib\win32 -classpath D:\product\10.1.3\OracleAS\dsa\jlib;D:\product\10.1.3\OracleAS\dsa\jlib\duf.jar;D:\product\10.1.3\OracleAS\lib\dms.jar;D:\product\10.1.3\OracleAS\oui\jlib\OraInstaller.jar;D:\product\10.1.3\OracleAS\jlib\srvm.jar;D:\product\10.1.3\OracleAS\jlib\netcfg.jar;D:\product\10.1.3\OracleAS\lib\xmlparserv2.jar;D:\product\10.1.3\OracleAS\assistants\jlib\assistantsCommon.jar;D:\product\10.1.3\OracleAS\jdbc\lib\classes12.zip;D:\product\10.1.3\OracleAS\jdbc\lib\nls_charset12.zip;D:\product\10.1.3\OracleAS\jlib\share.jar;D:\product\10.1.3\OracleAS\opmn\lib\optic.jar;D:\product\10.1.3\OracleAS\j2ee\home\jazn.jar;D:\product\10.1.3\OracleAS\jlib\ldapjclnt10.jar oracle.duf.dufserver.DufServer D:\product\10.1.3\OracleAS\dsa\dsa.conf"/&gt;
    &lt;/category&gt;
    &lt;/module-data&gt;
    &lt;/process-set&gt;
    &lt;/process-type&gt;
    &lt;/ias-component&gt;
    &lt;ias-component id="HTTP_Server"&gt;
    &lt;process-type id="HTTP_Server" module-id="OHS"&gt;
    &lt;environment&gt;
    &lt;variable id="PERL5LIB" value="D:\product\10.1.3\OracleAS\Apache\Apache\mod_perl\site\5.8.3\lib\MSWin32-x86-multi-thread;$ORACLE_HOME\perl\5.8.3\lib;$ORACLE_HOME\perl\site\5.8.3\lib"/&gt;
    &lt;variable id="PHPRC" value="D:\product\10.1.3\OracleAS\Apache\Apache\conf"/&gt;
    &lt;variable id="PATH" value="$ORACLE_HOME\Perl\5.8.3\bin\MSWin32-x86-multi-thread" append="true"/&gt;
    &lt;/environment&gt;
    &lt;module-data&gt;
    &lt;category id="start-parameters"&gt;
    &lt;data id="start-mode" value="ssl-enabled"/&gt;
    &lt;/category&gt;
    &lt;/module-data&gt;
    &lt;process-set id="HTTP_Server" numprocs="1"/&gt;
    &lt;/process-type&gt;
    &lt;/ias-component&gt;
    &lt;ias-component id="IASPT" status="disabled"&gt;
    &lt;environment&gt;
    &lt;variable id="LD_LIBRARY_PATH" value="D:\product\10.1.3\OracleAS/lib" append="true"/&gt;
    &lt;/environment&gt;
    &lt;process-type id="IASPT" module-id="IASPT" working-dir="D:\product\10.1.3\OracleAS/iaspt/bin"&gt;
    &lt;port id="ajp" range="7501-7600"/&gt;
    &lt;process-set id="IASPT" numprocs="1"/&gt;
    &lt;/process-type&gt;
    &lt;/ias-component&gt;
    &lt;ias-component id="OC4J"&gt;
    &lt;process-type id="home" module-id="OC4J" status="enabled"&gt;
    &lt;module-data&gt;
    &lt;category id="start-parameters"&gt;
    &lt;data id="java-options" value="-Xrs -server -Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false"/&gt;
    &lt;/category&gt;
    &lt;category id="stop-parameters"&gt;
    &lt;data id="java-options" value="-Djava.security.policy=$ORACLE_HOME/j2ee/home/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false"/&gt;
    &lt;/category&gt;
    &lt;/module-data&gt;
    &lt;start timeout="600" retry="2"/&gt;
    &lt;stop timeout="120"/&gt;
    &lt;restart timeout="720" retry="2"/&gt;
    &lt;port id="default-web-site" range="12501-12600" protocol="ajp"/&gt;
    &lt;port id="rmi" range="12401-12500"/&gt;
    &lt;port id="jms" range="12601-12700"/&gt;
    &lt;process-set id="default_group" numprocs="1"/&gt;
    &lt;/process-type&gt;
    &lt;/ias-component&gt;
    &lt;/ias-instance&gt;
    &lt;/process-manager&gt;
    &lt;/opmn&gt;
    I'm working with the Enterprise Manager 10g console.
    I can find the current monitoring of the heap space used in percentage, but cant find where to adjust it or increase it's space.
    searching around.
    thanks! but still searching...

  • Flex 3 Heap Size

    I've changed every config and ini file suggested to increase
    Flex's heap size. I've enabled the heap monitor on the console and
    it never increases over 64M. On the simplest code examples I exceed
    the heap limits and need to restart.
    Anyone have any other suggestions to increase the heap?
    Flex3 version 3.0.194161
    Eclipse Platform 3.3.1

    BUMP - I was really hoping someone could respond to this
    post, as I'm interested in hearing possible solutions.

  • Why JVM shows another Heap size when Xms=Xsx?

    Hi everybody. I have two instances of oc4j on a cluster of two nodes. The configuration of parameters on opmn.xml is exactly the same for both instances.
    Particulary I see an strange behavior on memory heap. I expect that if Xmx and Xms parameters are equals to 4096, then the heap size must be fixed on 4 Gb exactly, and there will be not resizing.
    But monitoring the heaps with JVisualVM I can see that the heap size of the first instance is moving between 3.7 and 4 Gb, and the Heap size of the second node is moving around 3.2 Gb. The hosts have both 16 Gb of RAM, it's running on Windows 2003 Server R2 and there is no overload on the OS.
    Possibly the behavior is normal and I just have a wrong understanding of what is expectable.
    Here are some parameteres extracted from opmn.xml file:
    -D64
    -Dcom.sun.management.jmxremote
    -Xmx4096M
    -Xms4096M
    -XX:+UseParallelGC
    -verbose:gc
    -XX:+PrintGCTimeStamps
    -XX:+PrintGCDetails
    -Xloggc:D:\oracle\product\10.1.3\soa\j2ee\OC4J_SOA\archivo_loggc.log
    -Dcom.sun.management.jmxremote.port=8004
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    -Djava.security.policy=D:\oracle\product\10.1.3\soa\j2ee\OC4J_SOA\config\java2.policy
    -Djava.awt.headless=true
    -Dhttp.webdir.enable=false
    -Doc4j.userThreads=true
    -Doracle.mdb.fastUndeploy=60
    -Doc4j.formauth.redirect=true
    -Djava.net.preferIPv4Stack=true
    -Dorabpel.home=D:\oracle\product\10.1.3\soa\bpel
    -Xbootclasspath/p:D:\oracle\product\10.1.3\soa\bpel\lib\orabpel-boot.jar
    -Dstdstream.filesize=8
    -Dstdstream.filenumber=30
    -Dhttp.proxySet=false
    -XX:MaxPermSize=768M
    -XX:PermSize=768M
    -Doraesb.home=D:\oracle\product\10.1.3\soa\integration\esb
    -Dorabpel.process.lock.timeout=300
    -Drmi.client.connection.timeout=100
    -Doracle.dms.hunter.sleeptime=600000
    -Doracle.dms.gatherers=300000,2:1800000:3
    -Djavax.net.ssl.keyStore=D:\oracle\product\10.1.3\soa\jdk\jre\lib\security\cacerts
    -Djavax.net.ssl.keyStorePassword=changeit
    -DopmnPingInterval=90
    -Xrs
    -DHTTPClient.socket.staleCheck=true
    -DHTTPClient.disableKeepAlives=true
    -XX:+HeapDumpOnOutOfMemoryError

    Hi Sebastien, Thanks for responding.
    In fact I'm looking exactly where you say to determine your heap size.
    The thing is that I can't understand why one instance takes some minor heap size and fluctuates the size while the other instance take around 4 Gb and kept static in this value. I can see there is no diferences on configuration for both. I know that the used heap must present diferent behavior, but not the total size. I think that the size should be fixed and static with Xmx=Xms=4096, but this is not happening.
    I would like to show an image to ilustrate what I'm describing.
    About the PermGen, I think there's no problem with that, around 80% is in effective use, and this value is stable.
    Best regards

  • Recommended heap sizes for Dev/Live/Shared CF boxes

    Hi all
    I've searched through all the relevant past posts, but most of them were posted before CF8.0.1 going 64-bit, so the situation has changed slightly.
    What are people's opinions on heap sizes for various server setups? I have my dev server - I leave this on 512MB and that's fine for most of the stuff I do. We generally up this to a gig on our live servers (which only run 3-4 small sites), and historically we've not gone above this on our Shared servers (which host anywhere up to 400 sites) because of the 32-bit limit.
    However, now we're running CF9 on 64-bit Server 2008, we've obviously got a lot more RAM available. The obvious choice is to ramp it up high, but I've also been heard that causes issues of its own - the Java GC then has far more work to do when it's called and as the memory fills it's harder to get a contiguous block of RAM, so performance can suffer.
    Does anyone have any experience of running Shared servers, or busy sites? The Server monitor is great for tuning maximum threads and the suchlike, but I can't really sit in front of it for hours waiting for the heap to fill. Also, our live servers are only Standard edition, so there's no Server Monitor.
    Thoughts?
    Ta
    O.

    function(){return A.apply(null,[this].concat($A(arguments)))}
    I have my dev server - I leave this on 512MB and that's fine for
    most of the stuff I do. We generally up this to a gig on our live
    servers (which only run 3-4 small sites), and historically we've not
    gone above this on our Shared servers (which host anywhere up to 400
    sites) because of the 32-bit limit.
    However, now we're running CF9 on 64-bit Server 2008, we've obviously got a lot more RAM available. The obvious choice is to ramp it up high, but I've also been heard that causes issues of its own - the Java GC then has far more work to do when it's called and as the memory fills it's harder to get a contiguous block of RAM, so performance can suffer.
    Leave the memory setting at the default value, until testing requires you to do otherwise, or your sites unravel some unforeseen memory demand. It's a risk our SysAdmin colleagues are prepared to take. With the coming of 64-bit, they've been on the alert, and have always cattle-prodded us whenever we've been tempted to push the button to go higher.
    Our defaults almost coincide with yours: 512 MB for 32-bit and just over 1GB for 64-bit. So what you yourself have just said is my own basic wisdom on the subject, too: if it aint broke, don't try to fix it.
    [postscript: I work full-time at one company, part-time at another. By pure coincidence, both use the same JVM memory settings.]

  • 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?

  • Performance Analayzer- ExecuteThread,CPU,HEAP SIZE

              I am looking for a performance analyzer which can give me some details as how many
              execute threads /jvm threads are used, how many objects are created, ejb usage,
              cpu utilization, heap size. Can you please suggest the best tool available.
              

    Depending how you need to use the values, most of them are available directly from
              the console. E.g., log into the console and go to "mydomain > Servers > myserver"
              then click on the Monitoring tab, then the Performance tab. You can also go to the
              Monitoring tab for each of your application components (jars and wars) you have.
              regards,
              -Ade
              "raj" <[email protected]> wrote in message news:[email protected]..
              >
              > I am looking for a performance analyzer which can give me some details as how many
              > execute threads /jvm threads are used, how many objects are created, ejb usage,
              > cpu utilization, heap size. Can you please suggest the best tool available.
              

  • The initial heap size must be less than or equal to the maximum heap size.

    All,
    Please help!!
    I have tested my Application Client Project in WSAD on my pc and it works fine.
    I have 1gb RAM on my pc. When I deploy the same app on another xp pc(same as mine but 512mb RAM) I get a heap size error. Here is the exact error:
    Incompatible initial and maximum heap sizes specified:
    initial size: 268435456 bytes, maximum heap size: 267380736 bytes
    The initial heap size must be less than or equal to the maximum heap size.
    The default initial and maximum heap sizes are 4194304 and 267380736 bytes.
    Usage: java [-options] class [args...]
    (to execute a class)
    or java -jar [-options] jarfile [args...]
    (to execute a jar file)
    where options include:
    -cp -classpath <directories and zip/jar files separated by ;>
    set search path for application classes and resources
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version
    -showversion print product version and continue
    -? -help print this help message
    -X print help on non-standard options
    Could not create the Java virtual machine.
    Press any key to continue . . .
    Here is the batch file that runs my app:
    @echo off
    SET appClientEar=C:\corp\apps\mts\jars\MTSClientEAR.ear
    set JVM_ARGS=-Xms256M -Xmx256M
    set CLIENT_PROPS=C:\corp\apps\mts\jars\medicalclient.properties
    set APP_ARGS=
    call C:\bnsf\IBM\WebSphere\AppClient\bin\launchClientBNSF.bat "%JVM_ARGS%" %appClientEar% "-CCpropfile=%CLIENT_PROPS%" %APP_ARGS%
    @pause
    I have changed the value of Xms and Xmx of JVM_ARGS to different size but I sitll get error. Anyone knows what the problem is. Thanks..

    Don't know why, but the "maximum heap size: 267380736 bytes" value is just slightly less than 256*1024*1024, wheras the reported initial size is equal to that.
    Try setting the initial value to 255MB.

  • What is the best way to verify default heap size in Java

    Hi All,
    What is the best way to verify default heap size in Java ? does it vary over JVM to JVM . I was reading this article http://javarevisited.blogspot.sg/2011/05/java-heap-space-memory-size-jvm.html , and it says default size is 128 MB but When I run following code :
    public static void main(String args[]) {
    int MB = 1024*1024;
    System.out.println(Runtime.getRuntime().totalMemory()/MB);
    It print "870" i.e. 870 MB.
    I am bit confused, what is the best way to verify default heap size in any JVM ?
    Edited by: 938864 on Jun 5, 2012 11:16 PM

    938864 wrote:
    Hi Kayaman,
    Sorry but I don't agree with you on verification part, Why not I can verify it ? to me default means value when I don't specify -Xms and -Xmx and by the way I was testing that program on 32 bit JRE 1.6 on Windows. I am also curious significant difference between 128MB and 870MB I saw, do you see anything obviously wrong ?That spec is outdated. Since Java 6 update 18 (Sun/Oracle implementation) the default maximum heap space is calculated based on total memory availability, but never more than 1GB on 32 bits JVMs / client VMs. On a 64 bits server VM the default can go as high as 32gb.
    The best way to verify ANYTHING is to address multiple sources of information and especially those produced by the source, not some page you find on the big bad internet. Even wikipedia is a whole lot better than any random internet site IMO. That's common sense, I can't believe you put much thought into it that you have to ask in a forum.

  • Any way to increase the default Heap size for all Java VMs in Solaris 8

    Hello,
    I have a java product that deals with large databases under Solaris 8. It is a jar file, started by a cron job every night. Some nights it will fail because it runs out of Heap memory depending on the amount of records it has to deal with. I know that I could increase the java VM heap size with "java -jar -mx YY JARFILE" command but I have other java products that are showing the same behavior, and I would like to correct them all in one shot if possible.
    What I would like to do is find a system or configuration parameter that forces all Java VMs to use a larger MAX Heap size than the default 16M specified in the Man page for Java. Is there a way to accomplish that?
    TIA
    Maizo

    You could always download the source and modify it.

  • Massive memory hemorrhage; heap size to go from about 64mb, to 1.3gb usage

    **[SOLVED]**
    Note: I posted this on stackoverflow as well, but a solution was not found.
    Here's the problem:
    [1] http://i.stack.imgur.com/sqqtS.png
    As you can see, the memory usage balloons out of control! I've had to add arguments to the JVM to increase the heapsize just to avoid out of memory errors while I figure out what's going on. Not good!
    ##Basic Application Summary (for context)
    This application is (eventually) going to be used for basic on screen CV and template matching type things for automation purposes. I want to achieve as high of a frame rate as possible for watching the screen, and handle all of the processing via a series of separate consumer threads.
    I quickly found out that the stock Robot class is really terrible speed wise, so I opened up the source, took out all of the duplicated effort and wasted overhead, and rebuilt it as my own class called FastRobot.
    ##The Class' Code:
        public class FastRobot {
             private Rectangle screenRect;
             private GraphicsDevice screen;
             private final Toolkit toolkit;
             private final Robot elRoboto;
             private final RobotPeer peer;
             private final Point gdloc;
             private final DirectColorModel screenCapCM;
             private final int[] bandmasks;
             public FastRobot() throws HeadlessException, AWTException {
                  this.screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                  this.screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
                  toolkit = Toolkit.getDefaultToolkit();
                  elRoboto = new Robot();
                  peer = ((ComponentFactory)toolkit).createRobot(elRoboto, screen);
                  gdloc = screen.getDefaultConfiguration().getBounds().getLocation();
                  this.screenRect.translate(gdloc.x, gdloc.y);
                  screenCapCM = new DirectColorModel(24,
                            /* red mask */    0x00FF0000,
                            /* green mask */  0x0000FF00,
                            /* blue mask */   0x000000FF);
                  bandmasks = new int[3];
                  bandmasks[0] = screenCapCM.getRedMask();
                  bandmasks[1] = screenCapCM.getGreenMask();
                  bandmasks[2] = screenCapCM.getBlueMask();
                  Toolkit.getDefaultToolkit().sync();
             public void autoResetGraphicsEnv() {
                  this.screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                  this.screen = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
             public void manuallySetGraphicsEnv(Rectangle screenRect, GraphicsDevice screen) {
                  this.screenRect = screenRect;
                  this.screen = screen;
             public BufferedImage createBufferedScreenCapture(int pixels[]) throws HeadlessException, AWTException {
        //          BufferedImage image;
                DataBufferInt buffer;
                WritableRaster raster;
                  pixels = peer.getRGBPixels(screenRect);
                  buffer = new DataBufferInt(pixels, pixels.length);
                  raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
                  return new BufferedImage(screenCapCM, raster, false, null);
             public int[] createArrayScreenCapture() throws HeadlessException, AWTException {
                       return peer.getRGBPixels(screenRect);
             public WritableRaster createRasterScreenCapture(int pixels[]) throws HeadlessException, AWTException {
             //     BufferedImage image;
                 DataBufferInt buffer;
                 WritableRaster raster;
                  pixels = peer.getRGBPixels(screenRect);
                  buffer = new DataBufferInt(pixels, pixels.length);
                  raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
             //     SunWritableRaster.makeTrackable(buffer);
                  return raster;
        }In essence, all I've changed from the original is moving many of the allocations from function bodies, and set them as attributes of the class so they're not called every time. Doing this actually had a significant affect on frame rate. Even on my severely under powered laptop, it went from ~4 fps with the stock Robot class, to ~30fps with my FastRobot class.
    ##First Test:
    When I started outofmemory errors in my main program, I set up this very simple test to keep an eye on the FastRobot. Note: this is the code which produced the heap profile above.
        public class TestFBot {
             public static void main(String[] args) {
                  try {
                       FastRobot fbot = new FastRobot();
                       double startTime = System.currentTimeMillis();
                       for (int i=0; i < 1000; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                  } catch (AWTException e) {
                       e.printStackTrace();
        }##Examined:
    It doesn't do this every time, which is really strange (and frustrating!). In fact, it rarely does it at all with the above code. However, the memory issue becomes easily reproducible if I have multiple for loops back to back.
    #Test 2
        public class TestFBot {
             public static void main(String[] args) {
                  try {
                       FastRobot fbot = new FastRobot();
                       double startTime = System.currentTimeMillis();
                       for (int i=0; i < 1000; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 500; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 200; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                       startTime = System.currentTimeMillis();
                       for (int i=0; i < 1500; i++)
                            fbot.createArrayScreenCapture();
                       System.out.println("Time taken: " + (System.currentTimeMillis() - startTime)/1000.);
                  } catch (AWTException e) {
                       e.printStackTrace();
        }##Examined
    The out of control heap is now reproducible I'd say about 80% of the time. I've looked all though the profiler, and the thing of most note (I think) is that the garbage collector seemingly stops right as the fourth and final loop begins.
    The output form the above code gave the following times:
    Time taken: 24.282 //Loop1
    Time taken: 11.294 //Loop2
    Time taken: 7.1 //Loop3
    Time taken: 70.739 //Loop4
    Now, if you sum the first three loops, it adds up to 42.676, which suspiciously corresponds to the exact time that the garbage collector stops, and the memory spikes.
    [2] http://i.stack.imgur.com/fSTOs.png
    Now, this is my first rodeo with profiling, not to mention the first time I've ever even thought about garbage collection -- it was always something that just kind of worked magically in the background -- so, I'm unsure what, if anything, I've found out.
    ##Additional Profile Information
    [3] http://i.stack.imgur.com/ENocy.png
    Augusto suggested looking at the memory profile. There are 1500+ `int[]` that are listed as "unreachable, but not yet collected." These are surely the `int[]` arrays that the `peer.getRGBPixels()` creates, but for some reason they're not being destroyed. This additional info, unfortunately, only adds to my confusion, as I'm not sure why the GC wouldn't be collecting them
    ##Profile using small heap argument -Xmx256m:
    At irreputable and Hot Licks suggestion I set the max heap size to something significantly smaller. While this does prevent it from making the 1gb jump in memory usage, it still doesn't explain why the program is ballooning to its max heap size upon entering the 4th iteration.
    [4] http://i.stack.imgur.com/bR3NP.png
    As you can see, the exact issue still exists, it's just been made smaller. ;) The issue with this solution is that the program, for some reason, is still eating through all of the memory it can -- there is also a marked change in fps performance from the first the iterations, which consume very little memory, and the final iteration, which consumes as much memory as it can.
    The question remains why is it ballooning at all?
    ##Results after hitting "Force Garbage Collection" button:
    At jtahlborn's suggestion, I hit the Force Garbage Collection button. It worked beautifully. It goes from 1gb of memory usage, down to the basline of 60mb or so.
    [5] http://i.stack.imgur.com/x4282.png
    So, this seems to be the cure. The question now is, how do I pro grammatically force the GC to do this?
    ##Results after adding local Peer to function's scope:
    At David Waters suggestion, I modified the `createArrayCapture()` function so that it holds a local `Peer` object.
    Unfortunately no change in the memory usage pattern.
    [6] http://i.stack.imgur.com/Ky5vb.png
    Still gets huge on the 3rd or 4th iteration.
    #Memory Pool Analysis:
    ###ScreenShots from the different memory pools
    ##All pools:
    [7] http://i.stack.imgur.com/nXXeo.png
    ##Eden Pool:
    [8] http://i.stack.imgur.com/R4ZHG.png
    ##Old Gen:
    [9] http://i.stack.imgur.com/gmfe2.png
    Just about all of the memory usage seems to fall in this pool.
    Note: PS Survivor Space had (apparently) 0 usage
    ##I'm left with several questions:
    (a) does the Garbage Profiler graph mean what I think it means? Or am I confusing correlation with causation? As I said, I'm in an unknown area with these issues.
    (b) If it is the garbage collector... what do I do about it..? Why is it stopping altogether, and then running at a reduced rate for the remainder of the program?
    (c) How do I fix this?
    Does anyone have any idea what's going on here?
    [1]: http://i.stack.imgur.com/sqqtS.png
    [2]: http://i.stack.imgur.com/fSTOs.png
    [3]: http://i.stack.imgur.com/ENocy.png
    [4]: http://i.stack.imgur.com/bR3NP.png
    [5]: http://i.stack.imgur.com/x4282.png
    [6]: http://i.stack.imgur.com/Ky5vb.png
    [7]: http://i.stack.imgur.com/nXXeo.png
    [8]: http://i.stack.imgur.com/R4ZHG.png
    [9]: http://i.stack.imgur.com/gmfe2.png
    Edited by: 991051 on Feb 28, 2013 11:30 AM
    Edited by: 991051 on Feb 28, 2013 11:35 AM
    Edited by: 991051 on Feb 28, 2013 11:36 AM
    Edited by: 991051 on Mar 1, 2013 9:44 AM

    SO came through.
    Turns out this issue was directly related to the garbage collector. The default one, for whatever reason, would get behind on its collection at points, and thus the memory would balloon out of control, which then, once allocated, became the new normal for the GC to operate at.
    Manually setting the GC to ConcurrentMarkSweep solved this issue completely. After numerous tests, I have been unable to reproduce the memory issue. The garbage collector does an excellent job of keeping on top of these minor collections.

Maybe you are looking for