[frs-110] Is it possible to use the Fusion Reactor API (FRAPI) to query current free memory? I wasn’t able to determine if it’s possible in the Java Docs. Any ideas?

This will be feature in a future update to FRAPI, in the mean time is a way to do this in ColdFusion;

<cfobject 
   action = "create"
   type = "java"
   class = "java.lang.Runtime"
   name = "RuntimeStatic">

<cfscript>
   rt = RuntimeStatic.getRuntime();
   maxmem = rt.maxMemory()1024;
   freemem = rt.freeMemory()1024;
   totalmem = rt.totalMemory()1024;
</cfscript>

<b>FreeMemory <cfoutput>#freemem#KB</cfoutput></b>
(an approximation to the total amount of memory currently
available for future allocated objects, measured in bytes)<br>

<b>UsedMemory <cfoutput>#totalmem-freemem#KB</cfoutput></b>
(the amount of memory currently used, measured in bytes)<br>

<b>TotalMemory <cfoutput>#totalmem#KB</cfoutput></b>
(the total amount of memory currently available for current
and future objects, measured in bytes)<br>

<b>MaxMemory <cfoutput>#maxmem#KB</cfoutput></b>
(the maximum amount of memory that the virtual machine will
attempt to use, measured in bytes)<br>

<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Runtime.html">Interpreting these figures</a>

Issue Details

Type: Technote
Issue Number: FRS-110
Components: CPU + Memory
Environment:
Resolution: Fixed
Last Updated: 03/Aug/07 1:52 PM
Affects Version:
Fixed Version:
Server:
Platform:
Related Issues:

Comments are closed.