Andy Wu said the following on 10/03/2012 03:04 PM:
Try using the same thread names or structdelete()'ing the data after each thread run completes.
Do you mean like this Andy?

<cfcomponent>
    <cffunction name = 'test' access='remote' returnformat='json'>

        <cfset var ii = 0 />
        <cfset var i = 0 />

        <cfloop from="1" to="500000" index="ii">
            <cfloop from="1" to="5" index="i">
<cfthread action="run" name="thread#i#" outer="#ii#" inner="#i#"> <cfset console("running thread number #outer# - #inner#") />
                </cfthread>
            </cfloop>

<!--- We don't have to join individual threads, but all 5 at once. Also no need to terminate them manually ---> <cfthread action="join" name="thread1,thread2,thread3,thread4,thread5" />
            <cfset StructDelete(cfthread, "thread1") />
            <cfset StructDelete(cfthread, "thread2") />
            <cfset StructDelete(cfthread, "thread3") />
            <cfset StructDelete(cfthread, "thread4") />
            <cfset StructDelete(cfthread, "thread5") />

        </cfloop>

        <cfreturn "done ;)" />
    </cffunction>
</cfcomponent>

I tried this code in Java6 something and it actually crashed the JVM at about 85,000 iterations (about 425k threads) with some error about the GC sweeper. Heap at about 3gb on Tomcat7 on Mint11 linux.

Then I tried this code in the latest Java7 and it got to about 80,000 iterations before it started doing excessive GCs (because the console would pause and then output a few hundred more log lines and then pause). Memory was at 43% of total system memory. Then at 105,000 it started going really fast again -- dropping memory down to 30% of total system. Then about at 165,000 it started being slow again. I eventually had to kill the process as it never resumed being fast again.

@Andy, unless you have another idea -- it seems that the data is not getting reaped by the GC.

.pjf





--
Peter J. Farrell
OpenBD Steering Committee / Mach-II Lead Developer
http://blog.maestropublishing.com
Identi.ca / Twitter: @maestrofjp

Please do not send me Microsoft Office/Apple iWork documents. Send OpenDocument 
instead! http://fsf.org/campaigns/opendocument/

--
online documentation: http://openbd.org/manual/
http://groups.google.com/group/openbd?hl=en

Reply via email to