What does your webservice/component do?  Since you’re calling it over and over again in the loop, are the values it’s returning things that you could cache, or stick into a lookup table, or some otherwise rewrite of the insides to that method)?  Maybe that would speed things up as well.

 

I assume you’ve profiled the page somehow, and are certain you’re looking at the “problem code area”, yes?

 

Just something else to check…

 

hth

 

Nolan Erck
Web Developer/Programmer
Schools Financial Credit Union
(916) 569-5409 Office
(916) 569-2024 Fax
www.schools.org

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Rouse
Sent: Thursday, March 09, 2006 10:54 AM
To:
[email protected]
Subject: Re: [CFCDev] how to destroy object in cfc: Questions

 

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) {
    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]




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

The information contained in this e-mail is confidential and may contain privileged information exempt from disclosure under applicable law. The information is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, employee, or agent responsible to deliver it to the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please delete the message from your computer and immediately notify the sender by telephone (you may call collect) at 916-569-5400 or by e-mail to [EMAIL PROTECTED] Thank you. ----------------------------------------------------------
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