Just a stab here, but maybe instead of using cfset's you can re-write
into a cfscript block?

Also, if this is in a cfc, be sure you have var-scoped every variable
(even temp ones)

Just some idea's off the cuff =) You could always post the entire
pertinent code to some place like cfm.pastebin.com

 


Chris Peterson
Gainey IT
Adobe Certified Advanced Coldfusion Developer

-----Original Message-----
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 11, 2007 10:08 AM
To: CF-Talk
Subject: Re: Memory Issue

Anyone got any ideas here?

On 10/10/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
>


--
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:290858
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