Question

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.

Was it helpful?

Solution

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.

<cfscript>
    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");
</cfscript>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top