4 ms·
The JVM itself doesn't add a huge memory footprint. I remember Charles Nutter of JRuby fame calling it the "20-30 MB memory tax" (see http://blog.headius.com/20
by sreque 10y ago
The JVM itself doesn't add a huge memory footprint. I remember Charles Nutter of JRuby fame calling it the "20-30 MB memory tax" (see http://blog.headius.com/2008/11/noise-cancelling.html http://blog.headius.com/2008/11/noise-cancelling.html).
A lot of the extra memory usage of Java apps comes from sloppy programming and from depending on lots of heavyweight libraries and frameworks.
- geodel 10y agoIf you include idiomatic Java programing as part of sloppy programming I also agree with that. https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/memory-efficient-java-tutorial.pdf https://www.cs.virginia.edu/kim/publicity/pldi09tutorials/me...
- sreque 10y agoMany things pointed out in this article apply to just about every managed language runtime. Implement a TreeSet in any language and you'll see the same overhead from object headers, memory alignment, etc. Java has some oddities that cause it to waste extra memory, but off the top of my head the only I can think of is 16-bit character Strings. Java 9 is supposed to help with that by allowing Strings to internally store utf8 characters. I do like the slide though showing that people tend to assemble abstractions together and completely lose sight of the performance costs of what they are doing. There's also the fallacy commonly held by many that because someone took the time to write a framework or library, they must have also taken the time to ensure it's optimized well.
- geodel 10y agoGo uses quite a bit less memory than Java. http://benchmarksgame.alioth.debian.org/u64q/go.html http://benchmarksgame.alioth.debian.org/u64q/go.html
- pjmlp 10y agoDue to value types support, which are part of Java 10's roadmap.
- geodel 10y agoI'd imagine it will be at least 5 years away when most popular Java software use this feature and java users see the effect of this.
- SureshG 10y agoAs per the Specjbb benchmark, JDK9 compact strings optimization itself provides, * 21% memory footprint reduction * 27% less GC * 5% throughput improvments https://www.infoq.com/presentations/java-se-9-cloud https://www.infoq.com/presentations/java-se-9-cloud - check this presentation for more details.
- geodel 10y agoImpressive numbers.