Improper use of the getPageContext().forward() function with ColdFusion MX may result in "java.lang.outOfMemoryError" or similar errors.
By definition, getPageContext().forward() is the same function in JSP as described at http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/jsp/PageContext.html#forward(java.lang.String).
Note the following remark from the above techdoc:
"Once this method has been called successfully, it is illegal for the calling Thread to attempt to modify the ServletResponse object. Any such attempt to do so, shall result in undefined behavior. Typically, callers immediately return from _jspService(...) after calling this method."
For ColdFusion users, this means it is illegal to generate any additional output after calling getPageContext().forward().
Be sure there is no output on the page after the getPageContext().forward() function.
The use of cfabort after the getPageContext().forward() function will force this behavior.
<cfif isdefined("form.submit")> <cfset newURL = "helloworld.cfm"> <cfset GetPageContext().Forward( newURL ) /> <cfabort> </cfif> <cfform method="post"> Test getPageContext().forward() <input name="submit" type="submit" value="GO" /> </cfform>