Can ColdFusion Access Windows Memory Values

Is there a way for ColdFusion 8/9, via Java or other means to retrieve or calculate memory metrics on the Windows OS such as jrun's Private Work Set Memory and Commit Memory values?

Note that the desired memory values are not to be confused with JVM free memory and other heap related stats available using the Java Runtime object. Thank you.


I was not familiar with it, but did a bit of searching and found this thread which suggests it can be done with .NET System.Diagnostics. Below is a translation, which seems to work CF 9 / .NET 3.5 / Win7. It should at least give you a starting point.

    process = createObject(".net", "System.Diagnostics.Process");
    PerfCounter = createObject(".net", "System.Diagnostics.PerformanceCounter")
    counter = PerfCounter.init("Process", "Working Set - Private", "jrun");
    WriteDump( (counter.get_RawValue() / 1024) &"K");

Need Your Help

Regular expression to find smallest possible match

javascript regex

I'm using a JavaScript regular expression /(&lt;mos&gt;[\s\S]*?&lt;\/mos&gt;)/g to find XML blocks in a log file that looks roughly like this: