[Support] Run out of Memory A lot? {1.12}

Discussion in 'Player Guides, Tips and Tricks' started by finch_rocks_1, Oct 11, 2014.

  1. Can you even like run photo realism or sphax at 3?
  2. Well I don't know about those kind of things. If you have a specific need like that then go for it, but ultimately the way java works, when you have a large heap (which is what these memory settings control), it makes the system "pause" longer to scan the entire thing looking for memory to free.

    Pauses are what causes noticable lag just as much as slow code. I've done extensive work on EMC fine tuning the garbage collection process and actually lowered max memory before.

    Ultimately here is our final settings:

    Code:
    // I've added notes on why they make sense to use.
    // Many found on this thread: http://www.spigotmc.org/threads/server-launch-sh.35/ by other
    // Large and experienced server owners.
    // Also see official Oracle JVM Tuning section: www.oracle.com/technetwork/java/tuning-139912.html#section4.2.6
    $baseOptions = ''
            . ' -Dfile.encoding=UTF-8' // Ensure files save as UTF8. Things break without this. See: EMC-261
            // == GC Tuning ==
            // This is low pause, keep server from ever spiking.
            // Very good details on why this is beneficial for MC: http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html#0.0.0.%20The%20Concurrent%20Low%20Pause%20Collector|outline
            .' -XX:+UseConcMarkSweepGC -XX:+UseParNewGC'
            // Enable I-CMS, optimizing pauses and distrbutes GC over longer period so TPS keeps stable
            .' -XX:+CMSIncrementalMode -XX:+CMSIncrementalPacing'
            //Uses more CPU but we have unused cores. So this is beneficial to keep TPS affect low.
            .' -XX:+CMSParallelRemarkEnabled' // Use multiple threads for CMS Sweeps
            //. ' -XX:+UseG1GC' // G1GC try it out
            . ' -XX:MaxGCPauseMillis=20' // Ensure never more than 1 TPS lost
            . ' -XX:+DisableExplicitGC' // Prevent plugins causing GC
            // == Misc Tweaks==
            . ' -XX:+AggressiveOpts' // Enables soon-to-be-default optimizations.
            . ' -XX:+UseFastAccessorMethods' // Optimizes getters... pretty respectable deal.
            . ' -XX:+UseBiasedLocking' // Enables a technique for improving the performance of uncontended synchronization.
            // Bukkit synchronizes things for safety that is never contended under ideal cases. This
            // Optimizes those cases, so that uncontended syncs are much cheaper.
            // == Memory Management ==
            . ' -XX:TargetSurvivorRatio=90  ' // Use the survivor area more effeciently.
            //. ' -verbose:gc '
            . ' -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=128K ' // Log the GC to file
            .' -XX:LargePageSizeInBytes=2M  -XX:+UseLargePages ' // The biggest gain, but we need to configure system to use it
    ;
    $gameOptions = $baseOptions . ' -Xmx9G -Xms5G'; // Give servers plenty of memory
    $bungeeOptions = $baseOptions . ' -Denvironment=production -Xms2G -Xmx4g -DIReallyKnowWhatIAmDoingISwear=1';
    
    I noticed OP has mojangs -XX+UseConcMarkSweepGC removed. It's EXTREMELY important to keep that or use G1GC at least.
    So your games arguments should be like
    Code:
    -Xmx4G -XX:+UseG1GC
    at the shortest.
    G1GC and ConcMarkSweep are something you choose one of (dont use both!!) and in my testing they are extremely close in benefits, but we settled on the older fashioned CMS for now.
    Mojang has defaulted CMS in the games profile, so if you removed it, you should add it back.
    DO NOT leave it up to Java to use default. Default is bad for MC.
    Gawadrolt and cadgamer101 like this.
  3. Bump for all those new players,
    Luckygreenbird and Trucker454 like this.
  4. you didn't fix the ConcMarkSweep issue.
    Patr1cV likes this.
  5. Updated Thread,

    Please let me know if there is a mistake,
    Luckygreenbird likes this.
  6. Nice thread.

    Hmm, did more people notice that 1.8.7 seems to gobble up way more resources than the previous versions?

    I started a hardcore session yesterday and my profile is set to the latest version. Then I noticed how awful my performance was, even though its pretty solid on EMC. Felt like recent post-1.8 release. At some points even 10 - 15 fps, when there was no reason to. Hmm, lemme...



    My wild base on my hardcore session. When playing with 1.8.7 I get 10 - 20 FPS here (and no; there are no hidden redstone contraptions, I didn't even manage to get diamonds yet). On 1.8.6: 60 - 80 fps easily.

    So I think versions can also play a huge role with this.
  7. Bump, got lost in page 4ish, I use this still :p
  8. Not sure if this is still possible to do in 1.12 / after installing forge that area in the profile that I would place -Xmx6G -XX:+UseG1GC no longer exists.
  9. I will look into it after I update and add new info/screens.
  10. I have updated Tutorial, and added new screens. I tested with Forge and LiteLoader. If you have any issues, feel free to ask.

    Updated for 1.12 and New Launcher!
  11. Thanks but I am still not sure how to update now as you can see from the image below the JVM argument field is no longer present.

  12. I cant seem to get mine to look like that...

    Here is Just forge,


    and with Forge and LiteLoader


    What type of installer did you use (I used exe as jar was not working for me)? Did you choose the default forge option (install Client) with a clean 1.12 downloaded?
    Silken_thread likes this.
  13. Yes I used the default Forge installer.

    I have sorted it now though via another way.

    in RUN I typed, sysdm.cpl

    This opened the following window: -



    From there click Advanced
    Then at the bottom of the next window click
    Environment Variables



    In the next window click to edit the System Variables and type in the highlighted section



    Pick the option below that suits your machine, for me I put 6G as I have 12G Ram to play with and I should never need to use this

    _JAVA_OPTIONS -Xmx1G
    _JAVA_OPTIONS -Xmx2G
    _JAVA_OPTIONS -Xmx3G
    _JAVA_OPTIONS -Xmx4G

    Then clicked ok to close this window and then restarted MC



    As you can see I now have 6G mem

    I also have optifine installed and with a few adjustment mainly with most particles off I have 49 fps
    TomvanWijnen and finch_rocks_1 like this.
  14. I demand more RAM: