Home Answers Viewqa Java-Beginners Controlling Java Heap Size Memory Allocation

 
 


Deepak Kumar
Controlling Java Heap Size Memory Allocation
1 Answer(s)      2 years and 5 months ago
Posted in : Java Beginners

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









Related Pages:
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
Java memory allocation
Java memory allocation  How does Java allocate stack and heap memory
Java Memory allocation - Java Interview Questions
Java Memory allocation  By default what is the memory allocation size for a single class? How the memory is allocated? Based on what procedure
Java get Heap Size
Java get Heap Size       In this section, we are going to illustrates you how to obtain the heap size. The heap is the area in the memory used for memory storage during
heap memory in j2me
heap memory in j2me  how to get j2me heap memory size
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
heap memory
heap memory  how long is the object stored in heap memory persist
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  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
Memory - Java Beginners
Memory management in Java  Where are these Heap and Stack? Is there size fixed? what is core area in memory
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
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
increase the JVM's maximum heap size. - Java Server Faces Questions
increase the JVM's maximum heap size.  Hi Friends ... How to increase the JVM's maximum heap size. Just now i am getting error like : Internal compiler error :java.lang.OutOfMemoryError give me any sugg.. Thanks
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
memory
memory   hi i am jane pls explain the difference between heap memory and stack memory
Determining Memory Usage in Java - java tutorial
Determining Memory Usage in Java 2001-08-28 The Java Specialists' Newsletter [Issue 029] - Determining Memory Usage in Java Author: Dr. Heinz M. Kabutz... parts in Java is guessing how much memory is being used by your object. We
Heap Sort in Java
Heap Sort in Java      ..._Sort.java C:\array\sorting>java heap_Sort Heap Sort... are going to sort integer values of an array using heap sort. There are two types
HEAP table
HEAP table  hiii, What is HEAP table?   hello, This type of table is stored in the memory. Speed of execution of this table is very commendable
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
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 Get Memory
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 Get Memory      
Array Review
Array Review Subscripts, Declaration, Allocation Array subscripts... are allocated on the heap, not on the stack. Copying an array reference doesn't copy the array. int[] a = int[100]; int[] b; The declared size of an array
memory management
memory management  Why objects store in heap
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space  Hi, How to resolve java.lang.OutOfMemoryError: Java heap space error. This error is coming while...: Java heap space where there is no more space available for the Java program
Controlling your program
statements (break, continue, return) in Java programming language. Selection The if statement: To start with controlling statements in Java, lets have.... That is the if statement in Java is a test of any boolean expression. The statement following
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
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
memory layout
memory layout  how much space does each segement(data,stack,heap,static) holds in memory? memory here refers to ram or hard disk
heap and stack in general programming language
heap and stack in general programming language  what's the difference between heap and stack ?   Hi Friend, Differences: 1)Stack is referred as temporary memory while Heap is referred as permanent memory. 2)In stack
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
memory management
memory management  memory management in java
ARRAY SIZE!!! - Java Beginners
ARRAY SIZE!!!  Hi, My Question is to: "Read integers from... don't know it's size (and I don't want to ask the user to enter it's size... number. However this is not elegant programming, and is a waste of memory. If you
Java file in memory
Java file in memory This section illustrates you how to map an entire file into memory for reading. Description of code: We used the FileChannel class... file directly into memory. size() method: This method of FileChannel class
java heap space & netbeans - Java Beginners
java heap space & netbeans  Java heap space". I'm using netbeans 5.1.1 and jdk1.5.0_07 version.. can any body say how can i know the amount of java heap space while i run...java heap space & netbeans Hey,all!! I've got a problem
Java Get Memory Usage
Java Get Memory Usage     ... of that unlike c++,  java don't tell that how much memory is occupied... memory from the actual memory. As you know in Java programming memory can
Java memory leak
Java memory leak  What is memory leak
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 Array Initialization
Java Array Initialization       After declaring an array variable, memory is allocated to it. The "new" operator is used for the allocation of  memory
Controlling Machines Remotely with Java - Java Tutorials
Controlling Machines Remotely with Java 2004-07-08 The Java Specialists' Newsletter [Issue 091] - Controlling Machines Remotely with Java Author... either via email or RSS. Welcome to the 91st edition of The Java(tm
java heap space bpbroble - Java Beginners
java heap space bpbroble  In my code i use JXmapViewier to show location on map but but after some time (When code is running )It give me exception that Java heap space problem how to solve that one or why this problem occurs
Controlling RDF Prefix in Java
Controlling RDF Prefix in Java   ... of Jena API for RDF. In RDF file there are two ways for Controlling RDF prefixes.  First is explicit prefix controlling and second is implicit prefix
How to set memory used by JVM in Ant
How to set memory used by JVM in Ant       This example illustrates how to set memory size of JVM (java virtual machine), when ANT (another neat tool) is used outside
Java memory optimization
Java memory optimization  When you think about optimization, what..., You can use memory dump and then analyze it to find the process/java code in your program which is using large amount of memory. Ideally java should garbage
memory
memory  what is memory
Java Get Example
values whether it is a database size or memory size using Java programming language... Java code you can easily get the available memory size and can print it on command.... Java get Heap Size In this section, we are going to illustrates
Java Memory Leak - Java Beginners
Java Memory Leak  I am having a memory leak in my java version of the game Snake. I have narrowed the exact step of when the program memory.... The actually object that's eating up my memory is an array of ints which grows
Java Get Example
values whether it is a database size or memory size using Java programming language... of the given Java code you can easily get the available memory size and can print.... Java get Heap Size In this section, we are going to illustrates
Out Of Memory Exception Erorr
Out Of Memory Exception Erorr  hello how are you?I hope you are fine I'm using jgrasp program my problem is in java programming my program compiled... understood that I have to increase the program memory but I don't know how?! *I gone

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.