Yes, that is how it was before trying to see if triggering the GC or wiping and recreating the object would help server resources. The page runs the same either way, just have not had to get back into it to change it back to creating the object outside the loop and removing the GC calls and the objSomething = "";
The thing that seems to save the server from crashing is mainly the objSomething = CreateObject("webservice", "url.to.some.cfc;
instead of objSomething = CreateObject("component", "a.dot.naming.some.cfc"); Best I can tell resources just are not released until the page has been fully loaded and ran, which is why I guess calling the web service makes it work most of the time since then you are calling a separate page as far as the server is concerned.
On 3/9/06, Mihai Manuta <[EMAIL PROTECTED]> wrote:
Instead of:
for(i=0;i lte 100000;i=i+1) {it is generally better to write:
objSomething = createObject("whatever","a.dot.naming.SomeClass");
objSomething.init();
... do something with objSomething
}
objSomething = createObject("whatever","a.dot.naming.SomeClass");In this way you will reuse the same object inside the loop, with many benefits to both memory and cpu.
for(i=0;i lte 100000;i=i+1) {
objSomething.init ();
... do something with objSomething
}
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]
--
Aaron Rouse
http://www.happyhacker.com/ ----------------------------------------------------------
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]
