works incorrectly under Windows, it returns the amount of used virtual
memory, not free. It's very easy to test - just load or unload some applications
and check the result.
JNIEXPORT jobject JNICALL
Java_com_jezhumble_javasysmon_WindowsMonitor_swap (JNIEnv *env, jobject
obj)
{...
(jlong) (pagesize * perfinfo.CommitTotal),
(jlong) (pagesize * perfinfo.CommitLimit));...
}
CommitTotal
The number of pages currently committed by the system. Note
that committing pages (using VirtualAlloc with MEM_COMMIT) changes this value
immediately; however, the physical memory is not charged until the pages are
accessed.
CommitLimit
The current maximum number of pages that can be
committed by the system without extending the paging file(s). This number can
change if memory is added or deleted, or if pagefiles have grown, shrunk, or
been added. If the paging file can be extended, this is a soft limit.
SY, GolemXIV