Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 105104  / 3 Years ago, sat, august 28, 2021, 6:06:12

On Windows, I could change how much RAM Java could use by typing something like -Xincgc -Xmx2048M in the Java Runtime Parameters. How can I do that in Ubuntu?


More From » java

 Answers
4

If I am not mistaken they are the same in Linux. With the Java command you have the 2 options:



  • Xmx sets the maximum memory heap size.

  • Xms sets the minimum memory heap size.


So doing -Xmx1024m -Xms128m should work.


Here is an extract from doing a man java in the terminal


-Xmsn
Specify the initial size, in bytes, of the memory allocation
pool. This value must be a multiple of 1024 greater than 1MB.
Append the letter k or K to indicate kilobytes, or m or M to
indicate megabytes. The default value is chosen at runtime
based on system configuration. For more information, see
HotSpot Ergonomics
Examples:

-Xms6291456
-Xms6144k
-Xms6m

-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 chosen at runtime
based on system configuration. For more information, see
HotSpot Ergonomics
Examples:

-Xmx83886080
-Xmx81920k
-Xmx80m

So that basically sums it up about doubts using the same parameters.


To use this go to a terminal and type it with a jar program. In my example I am using the minecraft server: java -Xms1024M -Xmx2048M -jar minecraft.jar.


Here is an image of what happens:


enter image description here


I should note that the parameters are Case Sensitive. So xmx1024M is not the same as Xmx1024M.


[#40165] Sunday, August 29, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
brasiplacar questions
Sat, Sep 4, 21, 13:11, 3 Years ago
Tue, Jan 10, 23, 06:22, 1 Year ago
Wed, Oct 13, 21, 15:19, 3 Years ago
Wed, May 4, 22, 00:06, 2 Years ago
Thu, Jan 5, 23, 15:40, 1 Year ago
;