I had this random thought the other day when messing around in FM. I would often get issues where a certain save would fail to load or certain in game features would cease to function. So im curious if Java’s memory allocation is allowed to access all of my RAM. I am indeed using a 64bit version of Java along with 64gb of memory. But what dictates how much of that memory Java can use? And is there a way to change it?
Or am I just hitting some kind of hard ceiling regardless? Because the save loading and feature failures coincide with extreme sizes of the proxies. Like into exponential range.
It might be best to look at the console window when an error occurs - it’ll likely provide more insight into the cause of the error, and it could be some sort of out-of-bounds variable causing issues, although exceeding the max value of a double in Java seems somewhat unlikely.
You can change the amount of memory allocated for Java’s VM heap by messing with the command in the startup .bat or .sh files - to set a minimum heap size of 2GB of memory and a max of 20GB, for example, edit the startup command to include something like
java -jar -Xms2G -Xmx20G at the beginning rather than the standard
java -jar. You can fiddle with the values as you’d like, although the heap size shouldn’t exceed your free memory and I can’t guarantee it’ll make a difference anyways.
It could also help to double-check that you’re actually using 64-bit Java, especially if you or another program might’ve installed a 32-bit version at any point in time. Try running
java -version from the command line and make sure the output mentions 64-bit, not 32-bit.
Java version is 64 bit. Thank you ill try the starup commands. However with your post I became aware that ive been using the application .exe versions this entire time. Does that matter at all?
In theory, the exe is designed to do the same thing as the .bat commands, but it seems to be coded to search for and use specific versions of Java, which won’t necessarily be the same Java version as the one in your Windows path (the one that shows when you type
java -version in a command window). It should still work with 64-bit versions, at least, and if you only have one version of Java installed it probably won’t matter, but you can’t exactly use it to set the heap size flags.
I see. Thank you for clearing that up. I feel silly asking this as ive done it before in the past im just drawling a blank as to how to edit start up command lines. Was it done in the file properties or is through cmd? Like I could’ve sworn it was just right click the file-properites then paste the edits into the name. Or was it making a short-cut and editing its properties?
Edit: Nevermind. Just straight up right clicked the start_dev batch file and I can edit it. I think i see now where to add the lines. It currently states this.
“java -Xmx10240M -jar “dist\FetishMaster.jar” gamedata devmode.”
So if Im reading that right 10gb of memory is the current allowance? Can I just change Xmx10240M to Xmx20G and be good to go?
Late, but yeah, that should work. No guarantees it’ll actually help, though.