On Thu, Dec 23, 2010 at 10:16 AM, Matthew Reinbold <matthew.reinb...@voxpopdesign.com> wrote: > > I know that correctly scoping variables in ColdFusion is important to prevent > unexpected results if a variable is "accidentally" reused elsewhere in a CFC. > But, if I remember correctly, in CFMX there were some pretty nasty memory > leaks that could occur if variables weren't scoped correctly. > > Does that apply to newer (8,9) versions of ColdFusion?
Yup. All function-local variables in a CFC should be var scoped. CF 9 did introduce the "local" scope inside of CFC methods, so doing this: <cffunction name="myFunction"> <cfset local.myVariable = "foo" /> </cffunction> is functionally equivalent to doing: <cffunction name="myFunction"> <cfset var myVariable = "foo" /> </cffunction> So while there are now 2 ways to declare a variable as local to a given function (assuming you're on CF 9), the requirement still remains that you do need to scope these variables properly in order to avoid leakage. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340256 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm