no wonder
why are you creating a new instance of the component every loop?
 
wouldnt this be better?
 
<!--- Get list of files --->
<cfdirectory name="files" directory="#application.config.dataFileRoot#" />
 
<cfscript>
 decrypter  = createObject("COMPONENT", "com.cogstate.ice");
 results  = createObject("COMPONENT", "com.cogstate.data");
</cfscript>
 
<!--- Loop through each file --->
<cfloop query="files">
 <!--- Decrypt File --->
 <cfset myFile = decrypter.decryptFile(fileName="#directory#\#name#") />
 
 <!--- Get Results --->
 <cfset myStruct = results.getResults(data="" />
 
 <!--- Populate Database --->
 <cfset results.putResults(data="" />
 
 <!--- Cleanup --->
 <cfset myFile = "" />
 <cfset myStruct = "" />
 
</cfloop>
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Dale Fraser
Sent: Tuesday, May 23, 2006 5:47 PM
To: [email protected]
Subject: [cfaussie] Re: JRUN Servlet Error

Ok,

 

I’ve fixed this, but for all you people who rely on CF memory management, DON’T!

 

Here’s the code

 

<!--- Get list of files --->

<cfdirectory name="files" directory="#application.config.dataFileRoot#" />

 

<!--- Loop through each file --->

<cfloop query="files">

      <!--- Decrypt File --->

      <cfinvoke component="com.cogstate.ice" method="decryptFile" returnvariable="myFile">

            <cfinvokeargument name="fileName" value="#directory#\#name#" />

      </cfinvoke>

     

      <!--- Get Results --->

      <cfinvoke component="com.cogstate.data" method="getResults" returnvariable="myStruct">

            <cfinvokeargument name="data" value="#myFile#" />

      </cfinvoke>

     

      <!--- Populate Database --->

      <cfinvoke component="com.cogstate.data" method="putResults">

            <cfinvokeargument name="data" value="#myStruct#" />

            <cfinvokeargument name="fileName" value="#name#" />

            <cfinvokeargument name="received" value="#receivedDate#" />

      </cfinvoke>

     

      <!--- Cleanup --->

      <cfset myFile = "" />

      <cfset myStruct = "" />

</cfloop>

 

Now the cleanup bit at the end fixed it, CF was running out of memory, I watched it happen on the server using task manager.

 

When I put the two <cfset ‘s in the memory went up a couple meg then down a couple meg rather than going from 70 to 500 and dying.

 

I used

 

<cfsetting enablecfoutputonly="yes" />

 

At the top of the page to ensure I don’t get lots of white space, I’m assuming this is only valid for the current page and won’t affect other pages.

Regards
Dale Fraser

 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to