The only way to do what yo want would be to use a temp struct as you
suggest or...

1) Instead of running code, call an init() function and put the query in
the var scope.
2) Less elegant... simply set the query equal to "".

=======================================================================
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 4:33 PM
> To: CF-Talk
> Subject: initialization section of CFCs
> 
> 
> Sure.  I don't want them because they're never used again, 
> and they're just wasting memory.  In the example below, the 
> recordset foo.rs is never used again after the object is 
> initialized.  I'd like to reclaim its memory.
> 
> >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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to