Java ordinary object pointer OOP

Reading Time: < 1 minute

I’ve come to find out this topic when I was watching a useful documentary about java fundamentals.  So the topic took my attention, and I’ve read some blogs regarding. It’s simply when you launch a 32 bit of jdk instance, defined variables will have such headers that will allocate some space in the memory, let’s assume it is 100byte, so if you launch the same app using the 64 bit of jdk, the usage and allocation will be doubled which will be 200 bytes. So this option will shrink the headers just in like 32 bits.

Since java 6 update 23 this parameter can be used only in 64 bit versions. When you launch a Java instance, add this parameter

-XX:-UseCompressedOops

Tools:

  • Eclipse Memory Analyzer http://www.eclipse.org/mat/
  • VisualVM: https://visualvm.java.net/

References

  • https://www.youtube.com/watch?v=FLcXf9pO27w
  • http://www.ibm.com/support/knowledgecenter/SSYKE2_8.0.0/com.ibm.java.win.80.doc/diag/understanding/mm_compressed_references.html
  • https://www.ibm.com/developerworks/community/blogs/kevgrig/entry/ibm_java_compressed_references_and_native_ooms?lang=en
  • https://wiki.openjdk.java.net/display/HotSpot/CompressedOops
  • https://www.javacodegeeks.com/2016/05/compressedoops-introduction-compressed-references-java.html
  • https://blog.codecentric.de/en/2014/02/35gb-heap-less-32gb-java-jvm-memory-oddities/