On Mar 9, 2004, at 12:26 PM, Craig Dudley wrote:

> Are you using the same variable name for the cfsavecontent?

Yes. On each iteration the savecontent overwrites the previous content
var.

That being said, I believe I solved the problem. I should have
mentioned I wasn't calling CFFILE directly in the loop, rather I had a
method in a CFC called "writeStaticFile" that accepted two params -
fileID and content. Once I pulled this logic out of the CFC and
directly into the code all is well. I can run the whole batch without
any perceptible increase in RAM usage.

Now, why passing it into the CFC would... is question for another day.

Here's the method, if anyone cares to comment.

<cffunction name="writeStaticPage" access="public" returntype="boolean"
output="false">

<cfargument name="content" required="yes" type="string"/>
<cfargument name="fileName" required="yes" type="string"/>

<cffile action=""
file="#expandpath('../static/'&arguments.fileName)#"
nameconflict="overwrite" addnewline="no" charset="utf-8"
output="#arguments.content#"/>

<cfreturn true/>
</cffunction>

>  -----Original Message-----
>  From: Sean Daniels [mailto:[EMAIL PROTECTED]
>  Sent: 09 March 2004 17:18
>  To: CF-Talk
>  Subject: Re: Writing Files without CFFILE
>
>
>  On Mar 9, 2004, at 11:50 AM, Adam Reynolds wrote:
>
>  > Your issue is the number of chunks you are trying to do it in.
>  Try
>  > doing it
>  >  in 2 parts.
>
>  I thought about doing that, but it seems inherently
>  non-scalable. Like,
>  if I break it into two parts, what happens when the database
>  returns
>  24,000 records instead of 14,000. I know I could do it in 5,000
>  record
>  chunks I guess, but I thought there might be something obvious
>  that was
>  more elegant.
>
>  >  cffile is probably ok but your cfsavecontent may be what is
>  causing
>  > you
>  >  issues as it may not be clearing down the content. You are
>  still
>  > creating
>  >  14000 pages inside memory space even though you are not
>  displaying
>  > them.
>  >  Have you considered that cfsavecontent may not be the right
>  thing
>  > here?
>
>  That's a good thought. I guess I could try passing the whole
>  HTML
>  string directly into cffile in the output attribute, but that's
>  gonna
>  be hard to read. Is there a way to "clear" the variable after
>  each
>  iteration of the loop that would release the RAM?
>    _____
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to