Are you a C programmer by any chance?

ColdFusion sits on top of Java, so you can't explicitly destroy objects. Java takes care of destroying objects that are no longer in use based on a complex algorithm that I think few people understand. If you need to get rid of the instance data for an object, you can write a clear() function to clear any instance data. However, with your example code, it's not really necessary since the variable (in the var scope) x only lives for the life of the function. So, the short answer to question one is, you don't need to explicitly destroy objects after you've created them.

I think that your second question is a matter of personal preference. I use createObject, but it's more of a personal preference than anything else.

Wayne

Ung, Seng wrote:
Hi:
from my test.cfc I do have the following function.
<cfcomponent >    
  <cffunction name="fnhello" returntype="string" access="private">
        <cfset var x="hi">
        <cfreturn x>
  </cffunction>
</cfcomponent >   
from my cfm, I called my test.cfc by doing the folloing code
<cfset o=createObject("component", "test")>
<cfset oFn=o.fnhello()>

Question number 1?
Once, I called or created an object named "o", Can I destroy the object by 
doing so? or by other methods?
<cfset o=null>

Question number 2?
Would you used "cfinvoke" or cfobject/createObject to call your cfc?

thanks
Seng




----------------------------------------------------------
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]




--
Wayne Graham
Earl Gregg Swem Library
College of William and Mary
PO Box 8794
Williamsburg, VA 23185
757.221.3112
http://swem.wm.edu/blogs/waynegraham/



----------------------------------------------------------
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