Comment by SamInTheShell
18 hours ago
I don't think you understand the threading concurrency topic. Also memory safety is so far off base here, where's that coming from? Java does some stuff okay, but do you really want to defend the horrid JVM problems? Also why can't I have my memory back when it's not in use in tightly packed systems?
It's not great for everything and neither is Go. You can find a bit more context on that in some of the other threads.
> defend the horrid JVM problems
Such as? It's one of the most widely used platform for backend services, basically almost all top 500 company has some business critical infrastructure running Java. It surely can't have "too horrid" problems..
I gave an example. Go allocate 8 gigs. Then get it garbage collected. Why is JVM still allocating 8 gigs?
We have Java services running on 512MB k8s nodes.
Furthermore, collection time (for moving collectors) is a function of the liveset, not the # of dead objects.
The JVM is awesome. The only problem with Java is all of the Java code that has ever been written.
> Also why can't I have my memory back when it's not in use in tightly packed systems?
That is changing as we speak:
[1] https://openjdk.org/jeps/8359211
[2] https://openjdk.org/jeps/546
[3] https://openjdk.org/jeps/8350152
> Also memory safety is so far off base here, where's that coming from?
It's coming from Go. In presence of data races on interfaces, slices or maps your memory might get corrupted.
> Also why can't I have my memory back when it's not in use in tightly packed systems?
You can. You have to either set your GC to be more aggressive or you need to utilize value types more.
The memory safety thing is just a moot out of scope contract. It seems moot to me every time someone shows up trying to push memory safety everywhere, that's a language to developer contract issue, not a functionality issue. When the contract of the language is such as that of Go vs Rust, the two languages are just offering different contracts. Rust just promises to hold your hand more than Go does.
Regarding the JVM and GC. Good luck with that? Every Java application I've seen in the wild when I supported JVM seemed to never release any ram it allocated. Ever. If it used 1G and even after free, the JVM decided that was going to be used again and wouldn't release it.
It would be hard to sell me on wanting to use Java again (people can pay me enough to do it, but I hate it). Which kinda sucks since Apache Foundation has a ton of really cool projects using it. Kotlin maybe, but I have no real use cases where it would be better than anything else I know right now.
When was the lat time you encountered such issue? The JVM has been more proactive in releasing memory back to the OS[1], and more work on dynamically setting the heap size (both up and down)
[1] https://openjdk.org/jeps/346
[2] https://openjdk.org/jeps/546
[3] https://openjdk.org/jeps/8350152
[4] https://openjdk.org/jeps/8359211
Memory safety ≠ memory efficiency.