Welcome to part three of my asynchronous thread, JVM out-of-memory discussion.
To recap: we have a process that creates ~1300, seven to ten page pdf form letters. This is done asynchronously using the <cfthread...> tag so that each thread can create one letter with associated database transactions and disappear. There was originally a problem with the threads - that once opened, they never closed. This appears to have been resolved yesterday by updating the ColdFusion server from 8.0.0 to 8.0.1. Now the issue is that if the process is allowed to run all at once, all the JVM memory is used up and the system starts throwing out-of-memory errors. The idea I am working with, as suggested in the previous discussion, is to throttle the process so that there are pauses. This should allow time for memory to be cleared between batches. The trouble is that this is not happening. Even with the pauses the memory does not seem to be released until the entire process runs. My theory is that the root thread spawning the child <cfthreads> is holding onto the memory objects, even the ones created in the child threads, until it is finished. So it can not be cleared until the main thread finishes. Is this logical? How autonomous are variables created in spawned threads? Is the default to create them in a 'thread' scope that is dropped when the child thread is done or in the calling parent thread? Is this somehow controllable? Can I declare the variables to be local to the thread, if so how? Does the 'Var' command work in threads the same as it does in functions to make a variable local? On a related note, the main memory hog is the <cfreport...> tag. If I comment out this tag, the memory usage only makes a small bump when the test code is run. The question is that we are using the 'filename' property of the <cfreport...> tag so there is no identified variable to work with here is there? What should be happening with whatever memory ColdFusion used to create the PDF file described in the <cfreport...> call after it is done with it? <!--- BUILD REPORT ---> <cfreport template="ren.cfr" format="pdf" overwrite="yes" filename=#vOutputFilePath#> <cfreportparam name="pFirmNo" value=#ResultFirms["firmno"][threadIndex]#> <cfreportparam name="pIssueDate" value=#DateFormat(pIssueDate, 'mm/dd/yy')#> <cfreportparam name="pRenewalId" value=#vRenewalSeq#> </cfreport> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307659 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4