Instead of:
for(i=0;i lte 100000;i=i+1) {
    objSomething = createObject("whatever","a.dot.naming.SomeClass");
    objSomething.init();
    ... do something with objSomething
}
it is generally better to write:
objSomething = createObject("whatever","a.dot.naming.SomeClass");
for(i=0;i lte 100000;i=i+1) {
    objSomething.init();
    ... do something with objSomething
}
In this way you will reuse the same object inside the loop, with many benefits to both memory and cpu.

Best regards,
Mihai


On Thu, 2006-03-09 at 10:16 -0600, Aaron Rouse wrote:
What if you had an CFC instance that was doing a lot of data manipulation within a loop?  I have noticed in some pages here that do just that, that the CF Service just keeps grabbing and grabbing resources from the server until the entire page has completed running or until the server runs out of resources.  It seems like it should be able to be forced to release the resources via triggering the GC manually although that is not what I have observed.  I do something like this to trigger the GC:
 
objSystem = CreateObject( "java", "java.lang.System" );
objSystem.gc();


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