Java uses too much ramPosted on November 13th, 2026 by Jon Yes, this has been hashed out thousands if not tens of thousands of times by others on the internet, but today I ran out of memory, and Firefox tabs started crashing, and when I go to see what is using all the RAM, I see an idle gradle daemon using 14GB. Every time I read one of these discussions the response seems to be "the JVM is actually genius, it's just using ram that would otherwise be unused, it will give it back when the OS needs it, you can change that behavior with ___, and users just don't understand". Maybe the JVM is genius. I am no expert on the topic, but when something uses all the ram in my PC and crashes something else (which happens a freaking lot) I tend to go down a rabbit hole. As a result I feel like I have read more about garbage collection than the average IT guy. I've read a lot of articles and discussions about all the clever things the JVM does and how the most advanced GC in the world is probably one built for it. I believe that. These discussions also like to rag on Go's GC. It's a design from the 70s. It's not a moving collector. It only just got rid of stop-the-world pauses. Here's the thing though: I've never had a go program use all the ram in my PC and crash other apps. Web-servers in go seem pretty happy on 2gb of ram, and Java apps are too unstable to run in production with 8gb. This is not an apples-to-apples comparison of course. Go apps do tend to be simpler and smaller in scope that Java apps, and maybe if I could figure out the right magic incantation of flags (or specialized JVM) my desktop Java apps would stop grinding my machine to a halt and crashing my browser. Whatever the reason, and in-spite of all the benchmarks, Go feels faster. |
|
|
|
|
Leave a Comment
Comments containing links will have them removed