I get a lag spike every ~15 seconds when the memory usage increases to 99% and then resets to ~15%
I have 4 gigs allocated and it's eating them up in 15 seconds.
Probably a memory leak but it's happening in all 1.8.* versions when it didn't before. (Also happens in snapshots)
Media:
Anyone having the same problem and/or knows how to solve it?
These args were setup for a server environment, but work really nicely on Minecraft. I've gotten ~10 more FPS on average with shaders with it, it basically eliminates the lag spikes (garbage collection) lag. Set the Xmx2G and Xms2G to whatever ram size you desire. 2GB should be enough for vanilla, 4 for mods I'd say.
These args were setup for a server environment, but work really nicely on Minecraft. I've gotten ~10 more FPS on average with shaders with it, it basically eliminates the lag spikes (garbage collection) lag. Set the Xmx2G and Xms2G to whatever ram size you desire. 2GB should be enough for vanilla, 4 for mods I'd say.
Goodluck!
Thanks!
Edit:
IT WORKED!
I've been having this issue for a long time and only recently posted about it, thank you!
This happens when you mess around with -Xmn, which should never be changed from the default Xmn128M; many people try increasing it to the size of the heap and as a result the "young generation", which is used to store short-lived objects (like the BlockPos nonsense added to 1.8, which is why you see the crazy memory churn) and should not be that large since garbage collection is expensive.
You can also see that the actual memory required by the game is a mere 150 MB, the minimum amount used after a garbage collection - it is way overkill to allocate more memory than the default 1 GB. In fact, here is a post which claims that performance increases with less memory allocated, down to just 512 MB (vanilla 1.8.7 with a render distance of 12 and no resource pack):
I myself simply use -Xmx768M -Xms768M -Xss1024K (vanilla and modded; my mods do not use any more memory than vanilla; actually, I even optimized them to offset any performance decrease) since I don't have a good enough CPU to support concurrent garbage collection without stuttering (the last argument is because I have 32 bit and it doesn't allocate enough stack space to avoid a stack overflow issue with water and lava mixing during world generation); the occasional 0.5-1 second lag spike isn't an issue (depending on how much I move, it can take up to an hour for a full GC to occur with smooth FPS otherwise; moving a couple thousand blocks in a minecart causes at least one GC). Note that I also play in 1.6.4, which only allocates 1-2 MB of memory per second when standing still, and when moving it is still much less than standing still in 1.8+ - Notch actually had the right idea when he reused objects instead of allocating new ones like crazy (a bad idea for a language like Java; Java is often blamed for poor performance but it is largely due to not taking into account its limitations, as with any language).
In fact, here is a post which claims that performance increases with less memory allocated, down to just 512 MB (vanilla 1.8.7 with a render distance of 12 and no resource pack):
To clarify, I saw no performance increase with less memory, I saw no difference in FPS regardless of whether I had 2GB allocated or 512MB allocated (since the minimum required is supposedly 2GB, theoretically the game should then use up at least 1GB of memory to warrant that 2GB requirement, theoretically, obviously my experiments prove otherwise). The FPS I got hovered around the same mark when chunk activity settled: between 90 and 150 FPS depending on a set of factors like complexity of the viewed blocks, chunk activity, etc.
Rollback Post to RevisionRollBack
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
To clarify, I saw no performance increase with less memory, I saw no difference in FPS regardless of whether I had 2GB allocated or 512MB allocated (since the minimum required is supposedly 2GB, theoretically the game should then use up at least 1GB of memory to warrant that 2GB requirement, theoretically, obviously my experiments prove otherwise). The FPS I got hovered around the same mark when chunk activity settled: between 90 and 150 FPS depending on a set of factors like complexity of the viewed blocks, chunk activity, etc.
That is the minimum amount of memory installed in your computer - NOT the minimum amount you should allocate to the game!
In fact, this statement all but proves where the myth that Minecraft requires gigs of RAM came from - a misunderstanding of the system requirements:
All software, when run, resides in the random access memory (RAM) of a computer. Memory requirements are defined after considering demands of the application, operating system, supporting software and files, and other running processes. Optimal performance of other unrelated software running on a multi-tasking computer system is also considered when defining this requirement.
Note that they include memory required by the OS and other processes - not just for the application itself (FWIW, 2 GB is also the minimum requirement for 64 bit Windows (7 or 10); 32 bit only requires 1 GB, and Oracle also says that 64 bit Java requires more memory).
That is the minimum amount of memory installed in your computer - NOT the minimum amount you should allocate to the game!
In fact, this statement all but proves where the myth that Minecraft requires gigs of RAM came from - a misunderstanding of the system requirements:
Note that they include memory required by the OS and other processes - not just for the application itself (FWIW, 2 GB is also the minimum requirement for 64 bit Windows (7 or 10); 32 bit only requires 1 GB, and Oracle also says that 64 bit Java requires more memory).
Read the next part of the sentence, I indirectly stated that. Usually minimum memory requirements dictate how much memory you should have installed, which is mostly based on the program's own requirements, plus that of the OS, plus a bit of headroom.
"since the minimum required is supposedly 2GB, theoretically the game should then use up at least 1GB of memory to warrant that 2GB requirement"
Mojang has stated you need at least 2GB installed, which means they expect the game to occupy around a gigabyte on it's own, plus the OS's usage which usually is about a gigabyte, plus headroom. That means they expect the game to occupy anywhere from say 700 or so MB to I'd say 1.3 or so GB, anywhere in that region, which my screenshots show it occupies ~300MB on default settings and resolution, using vanilla 1.8.7.
Rollback Post to RevisionRollBack
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
I get a lag spike every ~15 seconds when the memory usage increases to 99% and then resets to ~15%
I have 4 gigs allocated and it's eating them up in 15 seconds.
Probably a memory leak but it's happening in all 1.8.* versions when it didn't before. (Also happens in snapshots)
Media:

Anyone having the same problem and/or knows how to solve it?
Fix -- Use these JVM args:
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumTry these arguments in your JVM arguments line in your Minecraft client.
These args were setup for a server environment, but work really nicely on Minecraft. I've gotten ~10 more FPS on average with shaders with it, it basically eliminates the lag spikes (garbage collection) lag. Set the Xmx2G and Xms2G to whatever ram size you desire. 2GB should be enough for vanilla, 4 for mods I'd say.
Goodluck!
Thanks!
Edit:
IT WORKED!
I've been having this issue for a long time and only recently posted about it, thank you!
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo problemo! :), glad I could help!
This happens when you mess around with -Xmn, which should never be changed from the default Xmn128M; many people try increasing it to the size of the heap and as a result the "young generation", which is used to store short-lived objects (like the BlockPos nonsense added to 1.8, which is why you see the crazy memory churn) and should not be that large since garbage collection is expensive.
You can also see that the actual memory required by the game is a mere 150 MB, the minimum amount used after a garbage collection - it is way overkill to allocate more memory than the default 1 GB. In fact, here is a post which claims that performance increases with less memory allocated, down to just 512 MB (vanilla 1.8.7 with a render distance of 12 and no resource pack):
http://www.minecraftforum.net/forums/minecraft-xbox-360-edition/mcx360-discussion/2513182-why-the-console-editions-is-the-forgotten-dinosaur?comment=22
I myself simply use -Xmx768M -Xms768M -Xss1024K (vanilla and modded; my mods do not use any more memory than vanilla; actually, I even optimized them to offset any performance decrease) since I don't have a good enough CPU to support concurrent garbage collection without stuttering (the last argument is because I have 32 bit and it doesn't allocate enough stack space to avoid a stack overflow issue with water and lava mixing during world generation); the occasional 0.5-1 second lag spike isn't an issue (depending on how much I move, it can take up to an hour for a full GC to occur with smooth FPS otherwise; moving a couple thousand blocks in a minecart causes at least one GC). Note that I also play in 1.6.4, which only allocates 1-2 MB of memory per second when standing still, and when moving it is still much less than standing still in 1.8+ - Notch actually had the right idea when he reused objects instead of allocating new ones like crazy (a bad idea for a language like Java; Java is often blamed for poor performance but it is largely due to not taking into account its limitations, as with any language).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
To clarify, I saw no performance increase with less memory, I saw no difference in FPS regardless of whether I had 2GB allocated or 512MB allocated (since the minimum required is supposedly 2GB, theoretically the game should then use up at least 1GB of memory to warrant that 2GB requirement, theoretically, obviously my experiments prove otherwise). The FPS I got hovered around the same mark when chunk activity settled: between 90 and 150 FPS depending on a set of factors like complexity of the viewed blocks, chunk activity, etc.
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
Try reinstalling your Minecraft client, it fixes things sometimes.
That is the minimum amount of memory installed in your computer - NOT the minimum amount you should allocate to the game!
In fact, this statement all but proves where the myth that Minecraft requires gigs of RAM came from - a misunderstanding of the system requirements:
Note that they include memory required by the OS and other processes - not just for the application itself (FWIW, 2 GB is also the minimum requirement for 64 bit Windows (7 or 10); 32 bit only requires 1 GB, and Oracle also says that 64 bit Java requires more memory).
TheMasterCaver's First World - possibly the most caved-out world in Minecraft history - includes world download.
TheMasterCaver's World - my own version of Minecraft largely based on my views of how the game should have evolved since 1.6.4.
Why do I still play in 1.6.4?
Read the next part of the sentence, I indirectly stated that. Usually minimum memory requirements dictate how much memory you should have installed, which is mostly based on the program's own requirements, plus that of the OS, plus a bit of headroom.
"since the minimum required is supposedly 2GB, theoretically the game should then use up at least 1GB of memory to warrant that 2GB requirement"
Mojang has stated you need at least 2GB installed, which means they expect the game to occupy around a gigabyte on it's own, plus the OS's usage which usually is about a gigabyte, plus headroom. That means they expect the game to occupy anywhere from say 700 or so MB to I'd say 1.3 or so GB, anywhere in that region, which my screenshots show it occupies ~300MB on default settings and resolution, using vanilla 1.8.7.
Author of the Clarity, Serenity, Sapphire & Halcyon shader packs for Minecraft: Java Edition.
My Github page.
The entire Minecraft shader development community now has its own Discord server! Feel free to join and chat with all the developers!
-
View User Profile
-
View Posts
-
Send Message
ModeratorThread closed as OP's issue was fixed, someones thread isnt the place to discuss the best java arguments to use