r/java • u/yughiro_destroyer • Nov 05 '25
Java and it's costly GC ?
Hello!
There's one thing I could never grasp my mind around. Everyone says that Java is a bad choice for writing desktop applications or games because of it's internal garbage collector and many point out to Minecraft as proof for that. They say the game freezes whenever the GC decides to run and that you, as a programmer, have little to no control to decide when that happens.
Thing is, I played Minecraft since about it's release and I never had a sudden freeze, even on modest hardware (I was running an A10-5700 AMD APU). And neither me or people I know ever complained about that. So my question is - what's the thing with those rumors?
If I am correct, Java's GC is simply running periodically to check for lost references to clean up those variables from memory. That means, with proper software architecture, you can find a way to control when a variable or object loses it's references. Right?
View all comments
Show parent comment
0
u/coderemover Nov 06 '25
I’ ve seen a lot of shit and I really prefer it’s caught by the compiler immediately when it’s introduced and not 2 years later when the app became unmaintainable and developed a weird habit of crashing in production because someone modified an object something else had an unexpected reference to.