> When the cfinvoke tag is used with a component name, the component is
> instantiated and a method of the component is run. In most cases,
> there is no reference to the component returned. In other words, it's
> 'gone'. Is any of the memory used by the template request freed up at
> the time? If another cfinvoke tag is run, will it use the allocated
> memory that was used by the previous cfinvoke tag or will it take more
> memory for the request. Basically, if I have 20 cfinvokes running in a
> request, will it's memory usage grow for each invoke or will the
> memory be stable (assuming all of the invokes use the same amount of
> memory)?
>
> If the memory used by a cfinvoke is freed up to be used by other
> variables or cfinvokes, what about component references that are
> killed. In other words, if I use cfobject to create a variable
> containing a reference to a component, will overwriting that variable
> free up that memory for other us during the template run or is that
> memory no longer usable with the component still existing in memory
> but no longer accessible?

Components are really no different from any other variables. When no
more references to a variable exist, that variable is marked for
deletion. It will get deleted when the garbage collection gets around
to it. If you invoke a method of a component that doesn't return an
instance of that component, the component instance created by using
CFINVOKE itself is marked for deletion immediately, I'd expect. But
that doesn't mean you'll know when exactly it gets deleted, or that
there is a single right answer for when it will be deleted - after
all, you can configure the aggressiveness and parallel nature of
garbage collection in jvm.config.

It's highly unlikely that GC will happen during a specific single page
request in such a way to delete component instances created and marked
within that same request. So, I'd expect that each invocation within
the request will end up allocating its own memory, and that memory
won't be reused until sometime after the page request has completed.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:331497
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to