[1.12.2] IC2 is taking all my server RAM

  • Hello,


    I am running IC2 on my server with few other mods. But I got a noticiable issue with it.


    Actually when I run it on my 16Gb of RAM server, it put the RAM usage at the maximum I allowed for minecraft (12Go) even with no one online on the server it is all the time at 100%.


    But when I remove the mod, the RAM usage come back to normal (around 2,5Gb with no one on the server).


    I am running it on debian 9 using java 64 bits.


    Here are my java arguments:

    java -Xmx12G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:MaxGCPauseMillis=100 -XX:+DisableExplicitGC -XX:TargetSurvivorRatio=90 -XX:G1NewSizePercent=50 -XX:G1MaxNewSizePercent=80 -XX:G1MixedGCLiveThresholdPercent=35 -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -Dusing.aikars.flags=mcflags.emc.gs -jar Mohist.jar


    I am using: Industrial-Craft-2-Mod-Experimental-1.12.2.jar


    Here are the other mods installed in the server :

    Armourers-Workshop-1.12.2-0.49.1.jar

    Flan.s.Mod-1.12.2-5.6.0-beta.6.jar

    betteranimalsplus-1.12.2-7.0.0.jar

    Better-Diving-Mod-1.12.2.jar

    HarvestCraft-Mod-1.12.2.jar

    bookworm-1.12.2-2.3.0.jar

    CTM-MC1.12.2-0.3.2.20.jar

    furniture-6.3.1-1.12.2.jar

    Chisel-1.12.jar Mekanism-Mod-Core-1.12.2.jar

    ironchest-1.12.2-7.0.72.847.jar

    CodeChickenLib-1.12.2-3.2.2.353-universal.jar Mekanism-Mod-Generators-1.12.2.jar

    jei_1.12.2-4.15.0.293.jar

    Compact-Machines-Mod-1.12.2.jar

    Mekanism-Mod-Tools-1.12.2.jar

    ordinarycoins-1.12.2-1.5.jar

    Coral-Reef-Mod-1.12.2.jar

    MineTweaker-RecipeMaker-Mod-1.12.2.jar

    worldedit-forge-mc1.12.2-6.1.10-SNAPSHOT-dist.jar

    CraftTweaker2-1.12-4.1.20.jar Spartan-Shields-Mod-1.12.2.jar zawa-1.12.2-1.7.0.jar

    Custom-NPCs-Mod-1.12.2.jar Varied-Commodities-Mod-1.12.2.jar


    I hope you can help me finding the issue.


    Sincerely,

    Lockface77

  • Install sampler, remove -XX:+DisableExplicitGC and check what the "sampler memory --gc" command outputs. This is probably just peak memory use during startup remaining allocated due to your JVM config. How are you measuring memory use?


    I am btw unaware of very high mem use from IC2, even during startup.

  • Thank you for your answer,


    Here is the output of the command "sampler memory --gc":


    [07:47:07 INFO]: Heap: 412 / 1369 MB (max. 12884 MB).

    [07:47:07 INFO]: Non heap: 190 / 196 MB (max. 0 MB).

    [07:47:07 INFO]: Pool direct: 2 buffers using 2 MB (capacity 2 MB).

    [07:47:07 INFO]: Pool mapped: 0 buffers using 0 MB (capacity 0 MB).

    [07:47:07 INFO]: Classes: 21741, loaded 21741, unloaded 0

    [07:47:07 INFO]: MC display lists: 0, threads: 68.

    [07:47:07 INFO]: Total: 2113 MB in RAM, 0 MB in SWAP (virtual 19551 MB).

    [07:47:07 INFO]: System: RAM 2405 / 17179 MB, SWAP 0 / 0 MB.

    [07:47:07 INFO]: GC G1 Young Generation: 46x in 34158 ms (39800 ppm of uptime).

    [07:47:07 INFO]: GC G1 Old Generation: 1x in 2434 ms (2836 ppm of uptime).


    Oh my RAM was 100% during startup now but it falls down to 2014M, thank you, is it due to the removal of this argument? Or to the sampler plugin? Or both?

  • If you remove the arg and run "/sampler gc" or "/sampler memory --gc", Sampler will trigger a full GC run that gets rid of excess memory allocation. It looks like your GC config (JVM flags) isn't very good at reclaiming that memory by itself, it is too passive. You apparently had to wait a very long time for old gen GC to kick in without this provocation.


    Make sure to pass the nogui argument to the server command line, otherwise the lack of "-XX:+DisableExplicitGC" causes lag spikes due to the poor GUI code forcing GC twice a second... With nogui the arg shouldn't have any positive effect.


    The numbers look very good otherwise, just 412 MB of actual heap use. Everything else was transient or too lazy GC.