Can I ask why you _dont_ want the variables to stick? ======================================================================= Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia)
Email : [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda > -----Original Message----- > From: Brad Howerter [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 18, 2003 3:43 PM > To: CF-Talk > Subject: initialization section of CFCs > > > I notice that every variable created in a CFC's > initialization section stays in memory for the life of the > object. Is there a way to avoid that? One way I thought of > is to create every temporary variable in a particular > structure, then reset that structure at the end of the > initialization, but I'm wondering if there is a better way. > Here's a demonstration of my method, the class is employees, > which creates a collection of employee objects, using 'foo' > as the throw away structure. I'd appreciate your comments or > suggestions. > > <!--- this component will create structure 'priv' when > initialized. The foo structure is discarded. ---> > <cfcomponent name="employees"> > <cfquery name="foo.rs"> > select name, department > from emp > </cfquery> > <cfloop query="foo.rs"> <!--- once this loop is done, > foo.rs is no longer necc. ---> > <cfset priv[name] = createObject("component", > 'employee')> > <cfset priv[name].new(name, department)> > </cfloop> > <cfset foo = ''> <!--- free the foo memory ---> > > <cffunction name="getEmployeeByName" return="employee"> > <cfargument name="name"> > <cfreturn priv[arguments.name]> > </cffunction> > </cfcomponent> > > *** > The information in this e-mail is confidential and intended > solely for the individual or entity to whom it is addressed. > If you have received this e-mail in error please notify the > sender by return e-mail, delete this e-mail, and refrain from > any disclosure or action based on the information. > **** > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

