That's correct. On Thu, Mar 24, 2011 at 4:18 PM, Carl Von Stetten <vonner.li...@vonner.net>wrote:
> > I'm trying to wrap my head around this, so please excuse me for jumping > in. If I understand this correctly, the query result is an object > placed in memory when execution is complete, and variables.qry is merely > a pointer to that object. When the <cfset session.myQry = > variables.qry> is executed, a second pointer to the query object is > created, in the session scope. When page execution completes, the > variables.qry pointer disappears (and I assume is garbage collected at > some point), but because the session.myQry pointer still exists in the > session scope, the query object remains in memory instead of being > garbage collected. Once the session times out, assuming there are no > other pointers to the query object existing, it would then be garbage > collected. > > Is this a correct understanding, or am I completely off my rocker? > Thanks, > Carl > > On 3/24/2011 12:59 PM, Brian Kotek wrote: > > All complex data types are always passed by reference. Where you set them > > makes no difference. (Except arrays, which are passed by value due to a > > staggeringly poor decision eons ago.) > > > > > > On Thu, Mar 24, 2011 at 3:49 PM, Eric Cobb<cft...@ecartech.com> wrote: > > > >> I know that complex data types (structs, CFCs, queries, COM/JavaObjects, > >> etc...) are passed by reference, not by value. But I'm wondering how > >> that works when storing them in the session scope. > >> > >> For example, let's say I have a query that returns a really large result > >> set, and after that query runs I store the query results as a variable > >> in the session scope. > >> > >> <cfquery name="variables.qry"> > >> select * > >> FROM bigTable > >> </cfquery> > >> > >> <cfset session.myQry = variables.qry> > >> > >> Would the above code just create a reference to the result set already > >> in memory, or would it actually create a copy of the results in the > >> session? > > > >> In a similar scenario, what would happen if I had a CFC object stored in > >> the session, then passed my query results to it to be stored in that > >> CFCs "variables" scope? > >> > >> <cfquery name="variables.qry"> > >> select * > >> FROM bigTable > >> </cfquery> > >> > >> <cfset session.myCFC.blah(variables.qry)> > >> > >> -- > >> > >> Thanks, > >> > >> Eric Cobb > >> http://www.cfgears.com > >> Help me make a difference this summer. http://bit.ly/i8dJvQ > >> > >> > >> > >> > >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:343256 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm