Great answers guys – thanks!

 

Baz

 

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jim Davis
Sent: Sunday, November 20, 2005 7:30 PM
To: [email protected]
Subject: RE: [CFCDev] CFC By Reference

 

Bill mentioned this as well, but you’ve got to think about things differently.

 

For example think about this line:

 

<cfset variables.Object=createobject(MyCFC) />

 

More like this:

 

The component instance is created “in space” – it doesn’t exist in the variables scope.  Then after it’s created a pointer (reference) is made to it in the variables scope.  But it doesn’t exist there.  Later that pointer is copied to the Session scope.  The instance still lives “in space” but is now linked from two places (the variables scope and the session scope).

 

The request ends.  The pointer contained in the variables scope is gone, but the instance still exists and so does the pointer to it in the session scope.  Another template can use that reference as long as it exists in the scope.

 

Later however the session times out.  The point in the session scope is gone but the instance STILL EXISTS (“in space”).  However there are no pointers which link to it – and so nothing can use it.  This instance is now “garbage” and the system will soon run it’s “garbage collection” process which examines all instances and decides which are in use (have pointers to them) and which don’t (the garbage ones).  Garbage instances are then destroyed to make room for more stuff.

 

So you see the object instance never was in the “variables scope” (or anything other scope for that matter).  It exists outside the developer accessible scopes completely – only pointers live where the developer can “see” them.

 

Jim Davis

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected] ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to