ColdFusion Memory Usage Stats
Here are some code to find out some info about the memory usage of CFMX or BlueDragon. The Java API provides three methods in the java.lang.Runtime class: freeMemory, totalMemory, and maxMemory. These methods provide information about the JVM's memory usage, and its easy to access them with CFML:
<cfset runtime = CreateObject("java","java.lang.Runtime").getRuntime()> <cfset freeMemory = runtime.freeMemory() / 1024 / 1024> <cfset totalMemory = runtime.totalMemory() / 1024 / 1024> <cfset maxMemory = runtime.maxMemory() / 1024 / 1024> <cfoutput> Free Allocated Memory: #Round(freeMemory)#mb<br> Total Memory Allocated: #Round(totalMemory)#mb<br> Max Memory Available to JVM: #Round(maxMemory)#mb<br> </cfoutput>
From these numbers we can also determine the percent of free allocated memory available, and also the percent of avalaible memory allocated
<cfset percentFreeAllocated = Round((freeMemory / totalMemory) * 100)> <cfset percentAllocated = Round((totalMemory / maxMemory ) * 100)> <cfoutput> % of Free Allocated Memory: #percentFreeAllocated#%<br> % of Available Memory Allocated: #percentAllocated#%<br> </cfoutput>
Like this? Follow me ↯Tweet Follow @pfreitag
ColdFusion Memory Usage Stats was first published on March 15, 2004.
If you like reading about jvm, cf, java, heap, monitoring, or memory then you might also like:
- Server Memory Flash Remoting Tool
- Getting Size of Heap and Non Heap Memory in CFML
- Robi Sen on Hung Servers, java.lang.OutOfMemory errors and Tuning CF JVM
- 1.8GB Heap Limit in ColdFusion MX
- ColdFusion Garbage
- Have you tuned your JVM on ColdFusion MX yet?
- Updating Java on ColdFusion or Lucee
- Adobe Says Go Ahead and Upgrade your ColdFusion JVM
The FuseGuard Web Application Firewall for ColdFusion & CFML is a high performance, customizable engine that blocks various attacks against your ColdFusion applications.