• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why the difference between Runtime.totalMemory() and windoze?  RSS feed

 
Bruno Dery
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering why is there a difference between the metrics that the Runtime.get...Memory() show and Windows' task manager?
I do a little printout in an application I have which says
Memory status : Used: 13296736 - Free: 8473504 - Total: 21770240 - Max: 134217728 (which are the Runtime.get... metrics, those are in bytes), but in the task manager I see :
16000k as Mem Usage, and 56000k for the VM size (additional column I added to the view).
13296736 in bytes = 12985k which is not equal to 16000k and
21770240 in bytes = 21260k which is not equal to 56000k...

Why is this? Which one is the accurate measure?
Thanks!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows task manager shows the amount of RAM allocated to the JVM process by the "OS". Runtime.xxxMemory show the amount of memory available in the Java heap -- a fraction of the total amount. Out of the RAM allocated to the JVM, some of it is used for native code, and one big block is the Java heap.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!