java - Runtime.getRuntime() does not provide output in server -


i trying calculate runtime memory usage stub. working fine in eclipse when run same code on linux server, doesn't print 0. server configuration: 64-bit, 4 core server, 15gb ram

list<object> objlist = new arraylist<object>(); runtime runtime = runtime.getruntime(); long total1 = (runtime.totalmemory()) - (runtime.freememory()); (int = 0; < 100000; i++) {     object nee = new object();     objlist.add(nee); } long total2 = (runtime.totalmemory()) - (runtime.freememory()); system.out.println("total memory consumed : " + (total2 - total1)); 

getting value generating 2.5m objects nothing shown lower number of objects.

as per understanding ,the server having "precision" memory calculation. means, there no change in value of calculated memory till memory consumption doesn't crosses "precision" value.

now ,doubt how precision value determined , configurable??

it's common practice on servers redirect output stream away console, because there isn't one. speak server admin , check if it's going /dev/null, log file or similar.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -