I'm having issues with ColdFusion's heap. Here's a little example application I'm experimenting with. I thought after cfinvoke
calling the init
method it destroys all variables local to the component. But apparently it's not the case. The application works as it is below but if I add a zero to the loop in index.cfm
it breaks. What's stored in the heap to cause that? Is there a way around this?
index.cfm:
<cfloop from="1" to="1000" index="i">
<cfinvoke component="test" method="init" returnvariable="x">
</cfloop>
<cfoutput><p>#x#</p></cfoutput>
test.cfc:
<cfcomponent output="false">
<cffunction name="init" returntype="string">
<cfset var test = structNew()>
<cfloop from="1" to="1000" index="i">
<cfset test[i] = i>
</cfloop>
<cfreturn Now()>
</cffunction>
</cfcomponent>
And here's the error message:
SEVERE: Servlet.service() for servlet CfmServlet threw exception
javax.servlet.ServletException: ROOT CAUSE:
java.lang.OutOfMemoryError: Java heap space`
Any help would be appreciated.