Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Java option -Xmx stand for? [duplicate]

Tags:

java

java -Xmx1024m filename

what does -Xmx mean?

like image 441
ravi Avatar asked Mar 21 '11 06:03

ravi


People also ask

What does duplicate mean in Java?

Duplicate code as the name suggests is a repetition of a line or a block of code in the same file or sometimes in the same local environment. People might consider code duplication acceptable but in reality, it poses greater problems to your software than what you may have thought.

What is duplicate class in Java?

The "duplicate class" error can also occur when the class is named the same with the same package naming hierarchy, even if one of the classes exists in a directory structure with directory names different than the package names. This is shown in the next screen snapshot.

How do you duplicate a method in Java?

You do not have duplicate methods. The name of the parameter does not matter to the Java compiler so they have exactly the same signature.

Can list have duplicate in Java?

List allows duplicates while Set doesn't allow duplicate elements . All the elements of a Set should be unique if you try to insert the duplicate element in Set it would replace the existing value. List permits any number of null values in its collection while Set permits only one null value in its collection.


1 Answers

see here: Java Tool Doc, it says,

-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts. Examples:

           -Xmx83886080            -Xmx81920k            -Xmx80m 

So, in simple words, you are setting Java heap memory to a maximum of 1024 MB from the available memory, not more.

Notice there is NO SPACE between -Xmx and 1024m

It does not matter if you use uppercase or lowercase. For example: "-Xmx10G" and "-Xmx10g" do the exact same thing.

like image 179
Nishant Avatar answered Oct 10 '22 01:10

Nishant