I can confirm that a Web application I am working on (Jetty, Struts2, JDBC) consumes about 300 MBs more RAM (1.2G) right after startup when running in JRE 1.8.0_72 compared to JRE 1.7.0_80. The application is running on Centos 6 x64 and to make the memory measurement as transparent as possible I have disabled swap and set -Xms equal to -Xmx (40% of available RAM). I have used
dstat --top-mem or
top -m to get the total memory consumed by the java process.
Moreover when Web clients are connecting too often to the application, the total consumed memory rises until the system gets out of memory and kills the java process. The only what I can see is an information in /var/log/messages:
Nov 10 21:29:54 my kernel: Out of memory: Kill process 26610 (java) score 570 or sacrifice child
When I run an infinite loop from bash that invokes 4 parallel Web clients that connect to the application (= establish new TCP connection), request the application status and disconnect then the total memory consumed by the application rises about 100-200 KBs each minute. Each client does 6-10 requests per minute. Used heap memory size is stable.
In the way question is asked
why Java 8 allocating too much memory on my machine
I don't think anyone will be able to answer, however there are several guidelines which might help. Given that you are measuring memory via task manager you are interested in total RSS used. So
- Step 1:
Compare JVM defaults between version you are running. You can get them using
java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -versioncommand for both jdks. Using text sort on top of output you'll be able to get a nice diff using any compare tool. Things like changing default GC collector and thread stack size will affect final RSS a lot.
- Step 2:
Measure allocation for each memory pool. In general total memory used by java could be calculated using
heap + metasize + code cache + native + (thread_stack_size * maximum_number_of_threads)
- Heap memory easy measurable (and could be easy compared!!) by mature tools (Eclipse Memory Analyzer, VisualVM, etc.). If you memory increase in heap area -you are very lucky. In additional visual vm allow you to install plugin which will show values of all memory pools accessible via jmx.
- metasize (aka permgen in jdk<8) should more/less equal and could be found with
jmaptool. No need to play with flag, you can get number and just compare whenever it's increased or not.
- Code cache: in addition to reserved code cache there you can set initial code cache (and that will affect how much RSS is used).
- native: it's a bit of black sheep. If all other memory pools are equal (your memory bump is 2GB) memory lost must be somewhere in native area. The only tool I'm aware of is
jcmdand it has extensive documentation in oracle docs.
Non technical - whilst tweaking various options in order to reduce memory can help, the chances of getting right values are close to finding needle in haystack. I would really recommend to have a about how RSS is used in java. This knowledge will be handy for quite a few years!
Please let me know whenever you'd like more concrete references or better explanation. And... good luck with your quest ;-)
- Java 8 allocating too much memory
- Eclipse is using too much memory and what is the best configuration?
- CDT uses too much memory
- Java "constant string too long" compile error. Only happens using Ant, not when using Eclipse
- "insufficient memory for the Java Runtime Environment " message in eclipse
- Java 6 Update 25 VM crash: insufficient memory
- Setting memory of Java programs that runs from Eclipse
- Java is scaling much worse than C# over many cores?
- test memory consumption of a java program with eclipse
- Java application CPU/load much higher when built against JDK8
- 64-bit java won't allocate more than 2GB of heap memory
- It is taking too much time to run my application in eclipse
- Android receiving too much Bluetooth debug data
- How can I know how much memory Eclipse plugins use (separately)
- JAVA Tess4j doOCR() not working, Exception "Invalid memory access"
- Java memory leak
- Android After Adding Admob apk size increased too much
- Out of Memory (java heap) when running suite with too many test cases
- Eclipse plugin that can check which part of code is taking too much time?
- Java application memory size
- Phonegap-Skipped 33 frames! The application may be doing too much work on its main thread
- how to increase java memory (algorithms runs on ubuntu but not on mac; same machine configuration)
- Can anyone suggest eclipse tool to analyse java memory usage
- java memory leak difference between jar and debug
- How debugging is much easier in eclipse for java programs?
- Java caps memory
- How to increase heap memory of your java application in Eclipse
- Running out of memory Java Eclipse
- java.io.IOException: error=36, File name too long in java
More Query from same tag
- Inaccurate values returning from Emulator Control of Eclipse
- Where do the "Warnings" in Eclipse come from?
- Converting a Java Project to a Dynamic Web Project
- Browser is not launching when i run selenium webdriver
- Using Java 7 closure syntax in Eclipse 3.7.1
- In Eclipse, how to have launch configurations relative to the project?
- Including recyclerview library in Eclipse project (can't see the library project to include in my project)
- Compile java using script vs eclipse
- Hibernate/JPA works fine in Eclipse, throws a SchemaManagementException when deployed
- How to have a right to left editor plugin for Eclipse?
- Configuring Eclipse Content Assist for UIMA Ruta scripts
- How to change tomcat-users.xml when using Eclipse?
- Project description file(.project) is out of sync with the file system
- How to fix error occuring while executing EValidator
- No Synchronization in the Eclipse Navigator Window for the Neon Release
- AVD Eclipse "Unfortunately, Calculator has stopped." New error
- Java IDE - find all INDIRECT usages/references of a function or class?
- Confused about exporting jars for a project with may packages and main() without including the whole lot
- Error at building model of new Gradle project for libgdx
- Can you disable the cancel button in a jface wizard?
- xtext importURI external file
- Groovy Support in STS 3.9.0
- cannot create new android project in eclipse after updating sdk
- SVN How can i add 2 new files from one branch to another branch?
- Red arrow icon in subclipse
- Where can I find a recent version of the Zend Debug Protocol?
- Printing two dimensional array with brackets and commas
- What is the ‘correct’ way to configure the R ‘working directory’ and ‘Project location’ in Eclipse with StatET?
- How to use Jersey with Eclipse Helios?