I need to find out the peak memory usage of a maven
build, can I rely on the final output given by successful maven
build. Does 43M
indicates the peak memory usage during the maven
build. Thanks in advance.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.222 s
[INFO] Finished at: 2017-07-31T19:10:04+05:30
[INFO] Final Memory: 43M/636M
[INFO] ------------------------------------------------------------------------
Here :
Final Memory: 43M/636M
43M
is the used memory and 636M
the current allocated memory (heap size) by the JVM at the end of the build.
But these information could not give you the peak value.
Why the used memory (43M
) cannot be considered as the peak ?
Why the heap size (636M
) cannot be considered as the peak ?
Because the peak may be superior to the heap size if the GC reduced the heap size between the peak and the end of the build .
It may be the case for a very long build that performs intensive tasks at the beginning and lighter tasks then.
Because the peak may be inferior to the heap size if the GC has increased the heap size until this value but the application never needs to consume as much as memory.
To get the memory peak during the execution of the maven build, monitor the Java application (maven execution) with any JVM tool designed for : JVisualVM or JConsole for example.
Here's an screenshot of a maven build of a Spring Boot application monitored by JVisualVM that shows that neither the heap size or the used size at the end of build are the peak value :
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