Linux: Java Process Internal Memory (runtime) VS Linux VIRT / RES Memory
807591Apr 24 2008 — edited Apr 25 2008The following internal log record is created by the method below. The server seems stable and GC looks like it cleans up memory , SO, my question:
1. Why does the Memory VIRT + RES memory increase on Linux but the internal memory usage looks OK ?
2. Any way to lower the Java process memory footprint ?
Thanks for any feedback.
Linux Details:
Linux myBox 2.6.5-7.286-smp #1 SMP Thu May 31 10:12:58 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux
Process (top -puUserX):
11079 userX 23 0 486m 76m 6084 S 0 1.5 7:32.12 /home/userX/bin/java/jre1.6.0_05/bin/java -Xmx64M -jar server.jar -m 192.68.0.1
VIRT Memory = 486m
RES Memory = 76m
StdOut Log:
2008-04-24 20:11:54:209 [34821] INFO Memory Usage: 6.62/ Max: 9.50
/**
* General routine to return the memory usage
*
* @return Current runtime available memory and max available
*/
public String getMemory() {
//
// Define a double to hold the run time Total memory available
//
double t = rt.totalMemory();
//
// Define a double to hold the Free Memory
//
double f = rt.freeMemory();
//
// Calculate the used Memory
//
double u = ((t - f) / 1024) / 1024;
//
// Build and Format into readable form
//
return "Memory Usage: " + new DecimalFormat("0.00").format(u) + "/ Max: " + new DecimalFormat("0.00").format((t / 1024) / 1024);
}
Edited by: rbp_osborne on Apr 24, 2008 8:24 PM