I write a simple program and use jconsole.exe to monitor its heap size.
public class HeapTest {
public static void main(String[] args) {
while(true) {
}
}
}
Here is the result
I don't understand why the heap size keeps growing. I don't new() any Object in my program.
What is the heap used for in my program?
I don't add any additional arguments to jconsole.exe; just double click on it, then load the java process according to PID.
Environment: Java 1.8.0_25 under windows 7
There is no memory leak here. Replicated it in OSX as well. It would be the book keeping data generated by the normal functioning of the VM including that for the GC. The eden goes up and once the GC occurs, the memory used by the heap (eden) is reduced and the cycle starts again.
The confusing aspect is that there are no objects being created explictly by the program but it would make sense to expound that the JVM would be doing so and hence the gradual increase in eden space till the next GC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With