Greg's Blog

helping me remember what I figure out

Memory Usage

| Comments

Here is another code snippet, this time from the CF-Talk mailing list, which allows you to display server memory info.

<cfscript>
runtime = CreateObject(“java”,”java.lang.Runtime”).getRuntime();
freeMemory = runtime.freeMemory() / 1024 / 1024;
totalMemory = runtime.totalMemory() / 1024 / 1024;
maxMemory = runtime.maxMemory() / 1024 / 1024;

writeOutput(“Free Allocated Memory: ” & Round(freeMemory) & “mb<br />”);
writeOutput(“Total Memory Allocated: ” & Round(totalMemory) & “mb<br />”);
writeOutput(“Max Memory Available to JVM: ” & Round(maxMemory) & “mb<br />”);
</cfscript>