object - what is the life cycle of a ColdFusion CFC instance creation? -


i know how cfc instantiated in coldfusion under hood !. know create instance of component , reference newly created instance , can use call public methods inside them.

but happening when write th code

<cfscript>  person = createobject('component','human') // happen here!!!!  person.speak(); </cfscript> 

made correction statement here!!!. reason why ask question because have instance stored in application scope , instance used below

application.person.speak(); 

now under high load. found memory not release person obj , @ point reached 200mb.. strange! . made correction says in best practices

request.person = duplicate(application.person); 

now there direct way

request.person = createobject('component','human'); 

difference, first 1 creates object , keep in share scope, deep copy request everytime request made(here instance created once). second 1 instance creation every time request made. there performance difference between them sure because in second method instance created every time. know architecture behind creating instance makes less better former!!

just curies know !

coldfusion compiles java, , when call "createobject" function creating instance of class. here links might explain little more:

http://www.bennadel.com/blog/325-coldfusion-createobject-vs-java-newinstance-.htm

http://blog.objectorientedcoldfusion.org/2009/07/16/coldfusion-9-object-creation-performance/


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -