title: what is the life cycle of a ColdFusion CFC instance creation?
body: <p>I would like to know how a cfc is instantiated in coldfusion under the hood !. I know you create an instance of the component and you will get a reference to the newly created instance and you can use it to call the public methods inside them.</p>
  
  <p>But what exactly is happening when i write th code</p>
  
  <pre><code>&lt;cfscript&gt;
   person = createObject('component','human') // what happen here!!!!
   person.speak();
  &lt;/cfscript&gt;
  </code></pre>
  
  <p>Made some correction to my statement here!!!. the reason why i ask this question is because i have a instance stored in the application scope and the instance is used as below</p>
  
  <pre><code>application.person.speak();
  </code></pre>
  
  <p>now under very high load. i found that the memory is not release for the person obj and at some point it reached up to 200mb.. strange! . So made the correction as it says in best practices</p>
  
  <pre><code>request.person = duplicate(application.person);
  </code></pre>
  
  <p>now there is another direct way to do this is </p>
  
  <pre><code>request.person = createObject('component','human');
  </code></pre>
  
  <p>difference, the first one creates the object and keep it in share scope, do a deep copy to request everytime a request is made(here the instance is created only once). Second one does the instance creation every time the request is made. there is a performance difference between them for sure because in the second method the instance is created every time. I would like to know what exactly is the architecture behind creating an instance that makes it less better that the former!!</p>
  
  <p>Just curies to know !</p>