Controlling Java Heap Size Memory Allocation

Ads
 

Controlling Java Heap Size Memory Allocation

Hi,

Tell me about Controlling Java Heap Size Memory Allocation?

I have to run java program from console and allocate 2GB of RAM to Java Heap Size.

Thanks

View Answers

December 19, 2010 at 10:36 AM

Hi,

You can use the following command while running your java program:

java -Xmx2048m -classpath ".:${THE_CLASSPATH}" MyPrgoram

Here is the help of X option with Java:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\deepak>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
    -Xloggc:<file>    log GC status to a file with time stamps
    -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
    -Xfuture          enable strictest checks, anticipating future default
    -Xrs              reduce use of OS signals by Java/VM (see documentation)
    -Xcheck:jni       perform additional checks for JNI functions
    -Xshare:off       do not attempt to use shared class data
    -Xshare:auto      use shared class data if possible (default)
    -Xshare:on        require using shared class data, otherwise fail.

The -X options are non-standard and subject to change without notice.

C:\Documents and Settings\deepak>

Thanks

Ads









Related Tutorials/Questions & Answers:
Controlling Java Heap Size Memory Allocation
Controlling Java Heap Size Memory Allocation  Hi, Tell me about Controlling Java Heap Size Memory Allocation? I have to run java program from console and allocate 2GB of RAM to Java Heap Size. Thanks   Hi, You can
elasticsearch java heap space out of memory
elasticsearch java heap space out of memory  Hi, How to set heap size in elasticsearch to overcome java heap space out of memory? Thanks   Hi, Set following value in environment variables: export ES_HEAP_SIZE=10g
Advertisements
heap memory
heap memory  how long is the object stored in heap memory persist
java memory allocation for member variables and member functions
java memory allocation for member variables and member functions  ... an object q of test class then when shall the memory be allotted for function fun...() that has three variables a=5,b=6.My questions are 1>When will the memory be allotted
memory allocation
memory allocation   class Bird { { System.out.print("b1 "); } public Bird() { System.out.print("b2 "); } } class Raptor extends Bird { static... of execution of statement ? memory allocation ?  The code uses static
memory allocation
memory allocation  If we assign memory malloc(5) and access more than the assigned memory then what will happen? 1.segmentation error 2.memory leak 3.program will not compile 4.Your view
Memory Allocation
Memory Allocation  What Is The Order Of Execution Of Statement 1) Statement Enclosed in {}. 2) Static 3) Public Static Void Main()   When jvm loads a class, static block is executed first, then main method. And at last
heap and stack memory
heap and stack memory   hi i am jane pls explain the difference between heap memory and stack memory with example programs
heap and stack memory
heap and stack memory   hi i am jane pls explain the difference between heap memory and stack memory   STACK memory... after v came out from the program]. While HEAP memory is referred as permanent
How to set heap memory in cassandra on docker
_SIZE=2048M How to set the heap memory in cassandra on docker? Thanks  ...How to set heap memory in cassandra on docker  I am trying to run cassandra on docker and its throwing error asking to set the heap memory
Java heap space
options available to change Heap Size. 1 -Xms<size> set initial Java heap size 2 -Xmx<size> set maximum Java heap size 3 -Xss<size> set java thread stack size For example, you can set minimum heap to 64
hw to increazse heap size in my eclipse
hw to increazse heap size in my eclipse   how can i increase heap size using my eclipse
Java Heap
Java Heap       The JVM's heap stores all the objects generating by a running Java program. Java uses the new operator to create objects and memory for new objects is allocated
Java Get Memory
the memory size using Java programming language. This is a very simple example and you can easily learn it. In this Java Get Memory Size example, we have created...;: Code to Get Memory Size in Java public class Memory {     public static void
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space  Hi, In one of my..." java.lang.OutOfMemoryError: Java heap space How to resolve this issue? Thanks   Hi... your program. Check the thread Java heap space and java.lang.OutOfMemoryError
Array in Java
An Array is the static memory allocation that holds a fixed number of values of same type in memory. The size or length of an array is fixed when the array.... Different types of array used in Java are One-dimensional, Two-dimensional and multi
Java memory leak
Java memory leak  What is memory leak
heap sort in java
heap sort in java  plz modify this program so that it can take input as integers and string both..... public class heap_Sort{ public static void...("\n Heap Sort\n---------------\n"); System.out.println("\n Unsorted Array\n\n
Creating a memory leak with Java
Creating a memory leak with Java  Creating a memory leak with Java
Memory
Memory   what is the different between heap memory and stack memory ? please explain with example
using java.lang.OutOfMemoryError: Java heap space
using java.lang.OutOfMemoryError: Java heap space  i wrote a program... and my program has this error "using java.lang.OutOfMemoryError: Java heap space... is of size : " + filesizeInKB + " KB"); if(t1.isAlive()==false
memory
memory   hi i am jane pls explain the difference between heap memory and stack memory
Heap Sort in Java
Heap Sort in Java is used to sort integer values of an array. Like quicksort.... Example of Heap Sort in Java: public class eap_Sort{ public static void main...\sorting>Javac heap_Sort.java C:\array\sorting>java heap_Sort Heap Sort
Java Class Size
Java Class Size  How to determine size of java class
maximum size of arraylist - java
and interface?   1) It depend on heap size of machine and heap size depend...maximum size of arraylist - java  1.what is the maximum size...? 4.how many access specifier and how many access modifier in java? 5.what
There is insufficient memory for the Java Runtime Environment to continue.
There is insufficient memory for the Java Runtime Environment to continue.  Hi, I am getting error "There is insufficient memory for the Java...) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory
what is the size of java class
what is the size of java class  Could anyone tell me how to find the size of the class given below. public class Sample { private int x; private int y; private char ch; public static void main(String[] args) { Sample
memory management
memory management  Why objects store in heap
How to find hashtable size in Java?
How to find hashtable size in Java?  Hi, What is the code for Hashtable in Java? How to find hashtable size in Java? Give me the easy code. Thanks
Example of Hashset size() method in java.
Example of Hashset size() method in java. The size() is a method of HashSet class. It is used to calculte the size of HashSet. The size of method...); System.out.println("Size of HashSet : " + obHashSet.size
yarn.scheduler.minimum-allocation-mb
yarn.scheduler.minimum-allocation-mb  Hi, I am submitting an Java... as it outside max allowed. yarn.scheduler.minimum-allocation-mb How to solve... it: --driver-memory 1665m \ --driver-cores 2 \ --executor-memory 4g thanks

Ads