Maybe replace the
<cfset fileOutput.delete(0,fileOutput.length())>

With:

<cfset fileOutput.setLength(0)>

It would probably take less processing.

Mark

On 10/11/07, Rick Root <[EMAIL PROTECTED]> wrote:
> I'm trying to discover why a piece of code that I run causes my JVM
> memory usage to go up about 400MB.
>
> I'm using CF8... I'm not sure how to debug this.
>
> Basically I've got an event gateway request that generates an excel
> file (via HTML tables).  I do a lot of string appends and i'm using
> the java stringbuffer method.
>
> Some of the memory usage is the query - in my test case, the CF8
> server monitor says the query is about 50 megabytes.
>
> But obviously, something I'm doing in the looping through that query
> is sucking up memory.
>
> Here's a simplified example of the code in the loop... fileOutput is a
> java StringBuffer object.. the purpose of using the StringBuffer is
> because string concatenation in CF is very slow when done in high
> quantities.
>
>
> <cfloop query="resultSet">
>         <cfset fileOutput.append(START_ROW)>
>         <cfloop list="#fields#" index="ThisCol">
>                 <cfset 
> fileOutput.append(replace(START_FIELD,"___COLNAME___",ThisCol,"ALL"))>
>                 <cfset fileOutput.append( 
> resultSet[ThisCol][resultSet.currentRow] )>
>                 <cfset fileOutput.append(END_FIELD)>
>         </cfloop>
>         <cfset fileOutput.append(END_ROW)>
>         <cfif currentRow MOD 500 is 0>
>                 <cflog log="APPLICATION" text="Looping, currentrow = 
> #currentRow#">
>                 <cflog log="APPLICATION" text="Writing data to file, length:
> #fileOutput.length()#">
>                 <cfset fileWrite(fh, fileOutput.toString())>
>                 <cfset fileOutput.delete(0,fileOutput.length())>
>         </cfif>
> </cfloop>
>
> The total file size, when the job is complete, is about 84 megabytes.
> At the time the fileWrite() call takes place, the fileOutput variable
> contains about 3,000,000 characters (3mb)
>
> Anyone got any ideas here?
>
>
> --
> Rick Root
> Check out CFMBB, BlogCFM, ImageCFC, ImapCFC, CFFM, and more at
> www.opensourcecf.com
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Enterprise web applications, build robust, secure 
scalable apps today - Try it now ColdFusion Today
ColdFusion 8 beta - Build next generation apps

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290886
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to