Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Final Memory Output of Maven

Can someone explain me what does the Final Memory means in the maven output:-

[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:17 min (Wall Clock)
[INFO] Finished at: 2017-07-03T17:34:54+05:30
[INFO] Final Memory: 596M/2016M
[INFO] ------------------------------------------------------------------------

Is it the peak memory usage of maven during the execution? If yes then when I execute maven like below:-

/usr/bin/time -l mvn clean package

it reports maximum resident set size as 3671834624 bytes.

Can someone also let me know why the two numbers are different and how can I obtain the peak memory usage of a maven execution?

Environment:-

  • OS - MacOSX Sierra - 10.12.5 (16F73)
  • Maven - 3.5
like image 777
tuk Avatar asked Jul 03 '17 12:07

tuk


1 Answers

Final memory is calculated like this:

r = Runtime.getRuntime()
getLogger().info( 
"Final Memory: " + ( r.totalMemory() - r.freeMemory() ) / MB + "M/" + r.totalMemory() / MB + "M" );  

So the first number is the memory actually in use at time of the message, and second one is the total amount of memory (both used + available)

like image 89
Davit Mumladze Avatar answered Sep 28 '22 10:09

Davit Mumladze