I need to programmatically check the system load. I understand that there is no general way, and we need as a check on a separate Windows and Ubuntu
Asked
Active
Viewed 168 times
0
-
In case someone points out `Runtime.maxMemory()` and `Runtime.totalMemory()`, here's the [obligatory link](http://stackoverflow.com/questions/1463868/java-runtime-maxmemory-incorrect) on why they can be incorrect. – Vineet Reynolds Jul 07 '11 at 06:19
-
@Vineet - and they only report Heap memory usage from the JVM's perspective, not total memory usage from the system perspective; i.e. they don't report non-heap usage, physical page residency, paging rates, etc. – Stephen C Jul 07 '11 at 06:25
1 Answers
0
Given that your aim is to track down a memory leak (apparently), it would be better to use existing tools to monitor memory utilization; e.g.
- Java profiling tools included in the JDK.
- System specific tools such as "top", "vmstat", "iostat" and so on, and their Windows equivalents.
Trying to do this from Java is only going to confuse the issue.

Stephen C
- 698,415
- 94
- 811
- 1,216