Is there a command line utility within Windows or third-party program that can retrieve available RAM on a machine? (Since I don\'t believe this can be done in pure JAVA, si
Use wmic computersystem get TotalPhysicalMemory
. E.g.:
C:\>wmic computersystem get TotalPhysicalMemory
TotalPhysicalMemory
4294500352
systeminfo
is a command that will output system information, including available memory
wmic OS get TotalVisibleMemorySize /Value
Note not TotalPhysicalMemory
as suggested elsewhere
Here is a pure Java solution actually:
public static long getFreePhysicalMemory()
{
com.sun.management.OperatingSystemMXBean bean =
(com.sun.management.OperatingSystemMXBean)
java.lang.management.ManagementFactory.getOperatingSystemMXBean();
return bean.getFreePhysicalMemorySize();
}
Try MemLog. It does the job perfectly and quickly.
Download via one of many mirrors, e.g. this one: SoftPedia page for MemLog.
(MemLog's author has a web site. But this is down some times. Wayback machine snapshot here.)
Example output:
C:\>memlog
2012/02/01,13:22:02,878956544,-1128333312,2136678400,2138578944,-17809408,2147352576
878956544
being the free memory