Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

Allocating more RAM to java


  • Please log in to reply
25 replies to this topic

#1

CraftNinja2011

Posted 07 August 2012 - 12:03 PM

Hey, everyone.

So, I was testing out allocating more memory to Java (to see what all the fuss was about), first I made sure I had my parameters correct by starting MC in batch file:

"javaw -Xms1G -Xmx2G -cp minecraft.exe net.minecraft.LauncherFrame"

I did, the Allocated RAM now totaled 920MB (at 50%), instead of the standard 490MB (at 50%) - and for those of you thinking about trying this yourselves, I did actually get an extra 10-15FPS out of it.

So, I decided to add these parameters to the Java runtime environment.

In the Java Control Panel I added these parameters: -Xms1G -Xmx2G

I started up Minecraft, and it said 490MB (at 50%) allocated memory. It had not worked. So, I then added these parameters to test if the run-time environment was even executing the parameters:

-showversion > "%userprofile%\documents\it works.txt"

The file didn't show up, so I guess it isn't even performing the parameters when running MC. Now, I have both 64bit and 32bit java (Google Chrome - get off your asses Google and make us a 64bit version!), so, being as I had 2 javas. I made sure the runtime parameters were at the same filepath as where minecraft was executing javaw.exe. And it was (C:\Program files\java\jre7\bin\).

Also, I won't add "-d64", because I have Google Chrome (as already said), and I don't wont to cause an error forcing Chrome to try and read 64bit data sets.

Register or log in to remove.

#2

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 01:09 PM

think you want to use java to see output not javaw, because that doesn't display anything, or redirect the output to a file.

#3

CraftNinja2011

Posted 07 August 2012 - 01:14 PM

View PosttheFriedZombie, on 07 August 2012 - 01:09 PM, said:

think you want to use java to see output not javaw, because that doesn't display anything, or redirect the output to a file.

'tis a good point, since javaw has no console. But the initial parameters didn't work and I checked both the file for the Runtime parameters, and the process minecraft starts, they are exactly the same: C:\Program files\java\jre7\bin\javaw.exe

Again, I'm not sure if this is related to me running 32bit and 64bit java, but again, I don't want to use the "-d64" parameter.

#4

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 01:21 PM

View PostCraftNinja2011, on 07 August 2012 - 12:03 PM, said:

In the Java Control Panel I added these parameters: -Xms1G -Xmx2G
IF you added those to the control pannel you already allocate more ram to every java application you start.
What is the error message you get?

Make sure that your browser doesn't take up that much space in RAM :P
My recommendation remove the from the configuration, and stick to the java command.

#5

CraftNinja2011

Posted 07 August 2012 - 01:31 PM

View PosttheFriedZombie, on 07 August 2012 - 01:21 PM, said:

IF you added those to the control pannel you already allocate more ram to every java application you start.
What is the error message you get?

Make sure that your browser doesn't take up that much space in RAM Posted Image
My recommendation remove the from the configuration, and stick to the java command.

I don't get any error message. I ran with those parameters and have no extra allocated RAM.

Yet, doing the same parameters but in the command line, gives me the extra allocated RAM.

The problem is that java seems to be simply not recognizing the parameters as if they're not there.

View PosttheFriedZombie, on 07 August 2012 - 01:21 PM, said:

IF you added those to the control pannel you already allocate more ram to every java application you start.
What is the error message you get?

Make sure that your browser doesn't take up that much space in RAM Posted Image
My recommendation remove the from the configuration, and stick to the java command.

Oh, and also, nothing is taking up all my ram, I have 6GB of RAM, with Chrome Open, I'm using about 2GB of that, meaning there's still another 4GB left, there should be no problems running the parameters.

The one thing I haven't tried is a restart, I don't see that making a difference though, since it works in the command line (though, if you use Java in the command line, it uses a different runtime, instead of "C:\Program files\java\jre7\bin\javaw.exe", it uses a javaw.exe in the System32 folder.

#6

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 01:34 PM

@ECHO OFF
CD /D "%~dp0"
java -Xms1G -Xmx2G -cp minecraft.exe net.minecraft.LauncherFrame
pause
try this one, maybe you are running the thing as administrator? (could be by default).
Then it jumps to the system32 directory (don't ask me why)

run in the same directory as the minecraft.exe of course.

#7

CraftNinja2011

Posted 07 August 2012 - 01:50 PM

View PosttheFriedZombie, on 07 August 2012 - 01:34 PM, said:

@ECHO OFF
CD /D "%~dp0"
java -Xms1G -Xmx2G -cp minecraft.exe net.minecraft.LauncherFrame
pause
try this one, maybe you are running the thing as administrator? (could be by default).
Then it jumps to the system32 directory (don't ask me why)

run in the same directory as the minecraft.exe of course.

Sorry, but that won't make a difference to the batch file, because the batch file already sets it's CD to where it is executed, /d won't do anything different, either, since my only drive is the C drive

So, that extra line won't do anything, since the batch file is already setting CMD to the current directory.

Also, I'm having no problems giving Minecraft RAM with a batch file, I'm only having trouble doing it in the Java control panel.

#8

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 02:00 PM

Curious, if you dump those things in the java configuration panel.
And start it from the command line? what does happen then?

edit: I mean start it without allocation stuff in the command line of course


#9

CraftNinja2011

Posted 07 August 2012 - 02:16 PM

View PosttheFriedZombie, on 07 August 2012 - 02:00 PM, said:

Curious, if you dump those things in the java configuration panel.
And start it from the command line? what does happen then?

edit: I mean start it without allocation stuff in the command line of course

You mean use the command "javaw -cp minecraft.exe net.minecraft.LauncherFrame"?
Or, you mean putting "Xms" etc.. it parameters and starting minecraft using a batch.

There's only one way to find out.

#10

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 02:28 PM

java -cp minecraft.exe net.minecraft.LauncherFrame , from the command line
and the settings -Xms1G -Xmx2G in the control panel

Sorry should have been a bit clearer on that.

#11

CraftNinja2011

Posted 07 August 2012 - 02:35 PM

Spoiler:

As you can see from the spoiler contents, running through CMD with or without Java control Panel Parameters makes no difference (Running through CMD with no parameters does actually show more memory allocation, but less memory usage and equal FPS, though).

And running through minecraft.exe with or without Java Control Panel parameters will only allocate minecraft's default amount of RAM.

#12

CraftNinja2011

Posted 07 August 2012 - 03:23 PM

Wait, I've heard that it won't display a difference in the top right corner if you aren't using a batch file, though, it will use the extra RAM.

#13

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 03:31 PM

View PostCraftNinja2011, on 07 August 2012 - 03:23 PM, said:

Wait, I've heard that it won't display a difference in the top right corner if you aren't using a batch file, though, it will use the extra RAM.
Yeah and in most cases when you have enough ram it doesn't make a difference.
Also when you do give more/too much heap space to minecraft you run the risk of tarpitting it (writing it to the pagefile unneeded)

Small explanition about the -Xms -Xmx
-Xms sets the original heap size
-Xmx sets the maximum heap size

setting both those values to the same heap size (I recommend 1G for minecraft vanilla)
stops java from changing the heap size while running the game.
If java doesn't change heap size, it doesn't have to allocated or reallocate memory space for it. And thereby the game could run smoother.
so for vanilla minecraft starting it with:
java -Xmx1G -Xms1G -cp minecraft.exe net.minecraft.LauncherFrame
Can make a performance difference.


#14

CraftNinja2011

Posted 07 August 2012 - 03:58 PM

View PosttheFriedZombie, on 07 August 2012 - 03:31 PM, said:

Yeah and in most cases when you have enough ram it doesn't make a difference.
Also when you do give more/too much heap space to minecraft you run the risk of tarpitting it (writing it to the pagefile unneeded)

Small explanition about the -Xms -Xmx
-Xms sets the original heap size
-Xmx sets the maximum heap size

setting both those values to the same heap size (I recommend 1G for minecraft vanilla)
stops java from changing the heap size while running the game.
If java doesn't change heap size, it doesn't have to allocated or reallocate memory space for it. And thereby the game could run smoother.
so for vanilla minecraft starting it with:
java -Xmx1G -Xms1G -cp minecraft.exe net.minecraft.LauncherFrame
Can make a performance difference.

I already know about Xms/Xmx/cp/jar etc...

I've found you can actually run MC from command line with: java/javaw (parameters, if you want) -jar minecraft.exe

Also, I wasn't having a problem with Memory Usage, I was just seeing what the fuss is about for Memory Allocation, I was doing research, basically.

I eventually found that Minecraft actually has it's own Xms/Xmx parameters set, so any Xms/Xmx parameters defined in the Java Control Panel is overridden by Minecraft's own parameters, wether "-Xincgc" makes much of difference is debatable, but if people want to try it then, they might as well.

If you really wanted to see if makes a difference, run a batch launch of minecraft with the "-verbose:gc" parameter.

But, there is a way to override minecrafts override parameters, and that is with a batchfile/CMD, as I've already discovered.

Personally, my MC RAM usage rarely goes over 400MB, so I would recommend just setting the parameters in any batch files you run to "-Xms512M -Xmx1G" (default Minecraft RAM usage).

#15

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 04:01 PM

I know and -Xincgc doesn't do that much either in most cases

#16

CraftNinja2011

Posted 07 August 2012 - 04:12 PM

View PosttheFriedZombie, on 07 August 2012 - 04:01 PM, said:

I know and -Xincgc doesn't do that much either in most cases

I suppose I could just test it using -verbose:gc

But do you know a way to get the verbose command (whether it's verbose:class or verbose:gc) to display in a neat format?

I've used the verbose:class argument before, but it displays in the log REALLY messily, I want it to display line by line to each class.

#17

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 04:14 PM

Yah don't use notepad :P

Use any other editor but no notepad (I like notepad++)


#18

CraftNinja2011

Posted 07 August 2012 - 04:16 PM

View PosttheFriedZombie, on 07 August 2012 - 04:14 PM, said:

Yah don't use notepad Posted Image

Use any other editor but no notepad (I like notepad++)
Heheh, I had Visual C++, I know it's designed for C++, but will that display Java log's format correctly?

#19

theFriedZombie
  • Location: the Netherlands
  • Minecraft: theFriedZombie

Posted 07 August 2012 - 04:17 PM

Sure

#20

CraftNinja2011

Posted 07 August 2012 - 04:27 PM

View PosttheFriedZombie, on 07 August 2012 - 04:17 PM, said:

Sure
Wow, I just ran with verbose:class, and the log is huge, not really much use, since checking it would mean scrolling down for hours, I 'spose if there is a launcher issue, it's acceptable, since the launcher uses less class files.