Java Heap Memory Issues and Rust Alternative

By recently working with Java, I asked myself: 4GB for heap memory and vm still crashing during unit tests? I believe this turned into something common to Java devs, I mean, not the crash, but reserve 4GB to the app to run. The whole sort of boxing, garbage collection and syntax sugar available on Java, made language more easier over the time, but also made software produced by it less efficient to deal with actual hardware. Java should be consuming less hardware, not more. I decided to focus on rust because he has a more honest approach on how tech is evolving. #rust #java #programming #memory #hardware #tech #performance

Adam Kalisz

Tech and business consulting, hands-on application development, performance debugging, conflict resolution, robustness and security so you can accelerate and focus on your core business

3w

Java is pretty memory inefficient in places but that usually isn’t the main issue. Developers just do a lot of garbage or hang onto stuff they no longer need but that consumes memory and CPU cycles. From the little work I have done in Rust it felt a lot nicer than C to me so if I had to do something that’s usually done in C, I would choose Rust instead. On the JVM I of course would choose Clojure and pay the cost in exchange for moving forward quickly yet still producing solid and reasonably performant stuff.

Boxing overhead is unfortunately here to stay for a while until the value typing and generics overhauling of Project Valhalla get delivered. Assuming they get GAed in Java 30, this means a decade and a half until such things would be ubiquitous in production Java.

Depends in what you are working on but 4gb of heap is not something to ignore. If it happened to me, my very first reaction would be to check if I don't have a memory leak. But yeah java is "memvore"

See more comments

To view or add a comment, sign in

Explore content categories