>> If I have a CFC that has a lot of methods and I create, say, 1000 of 
>> these
>> objects, does coldFusion use a lot of memory, or is it not much worse 
>> than
>> creating 1 of the objects?  In other words, are the methods shared 
>> across
>> objects, or does it recreate them for each new object?
>
>Well, the method *code* is certainly shared across all the objects - a 
>method name="foo" becomes a Java method "funcFOO" on the class (to 
>which the component is compiled). The method code is compiled into the 
>.class file and exists in only one place, regardless of how many 
>objects are created.
>
>However, I believe that when you create a CFC instance, you get 
>(effectively) a Java Map (actually an implementation of a Map) that has 
>entries for each method. Each entry is merely a 'pointer' to the 
>representation of the method. I'm guessing that based on the fact that 
>you can access methods of a CFC instance as variables:
>
>fn.cfc:
>       <cfcomponent>
>               <cffunction name="foo">
>               </cffunction>
>       </cfcomponent>
>
>tfn.cfm:
>       <cfscript>
>               x = createObject("component","fn");
>               y = x["foo"];
>               y = x.foo;
>       </cfscript>
>
>So, in each CFC instance you create, you will get entries in the Map 
>for every method (or, at least, every public method) but those entries 
>won't take up a great deal of space (since they are just "name, 
>pointer" pairs).
>
>Sean
>
>                Pacific Coast Cat Fanciers
>"Summer In The City" -- June 7 & 8, 2003 -- San Jose, CA
>            http://www.corfield.org/pccf/flyer/
>

Good answer; that's just what I wanted to hear.  Thanks very much!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Host with the leader in ColdFusion hosting. 
Voted #1 ColdFusion host by CF Developers. 
Offering shared and dedicated hosting options. 
www.cfxhosting.com/default.cfm?redirect=10481

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

Reply via email to