9 Replies Latest reply: Jul 14, 2012 5:27 AM by BKBK RSS

    COLDFUSION 9 MEMORY LEAK: keeping unreferenced cfc's alive until end of request (CF8 does not)

    elklaaso Community Member

      This piece of code:

       

                      <cfscript>

                      for (j = 1 ; j LTE 500000 ; j = (j + 1))

                      {

                              dummyc = createObject("component","Dummy");

                              dummyc.dummyf();

                      }

                      </cfscript>

       

      that creates objects like this one:

       

      <cfcomponent name="Dummy" output="false">

              <cffunction name="dummyf" access="public" output="false" hint="" returnType="void">

              </cffunction>

      </cfcomponent>

       

      A function needs to be executed on the cfc for it to start using memory, seems like its lazy-initialized.

       

      Is using upto about 2 gigabytes of memory on CF9.

      And almost nothing on CF8.

       

      I analyzed a heap dump in eclipse memory analysis tool (MAT).

       

      All the cfc's created in cf9 stay referenced under a java object and this

      is why they are not garbage collected.

      The cfc's in memory comprise of CFdummycomponent, variablescope and some other java objects. Because the references to them are kept, even though they are not referenced in coldfusion anymore, java cannot garbage collect them.

       

      This basically means that batch processing can not be done with coldfusion anymore (using cfc's), unless a lot of memory is allocated.

      On cf8 this was not a problem, because stuff not referenced in coldfusion was

      not references in underlying java either anymore.

       

      (cf8 did keep queries, cfsavecontent and some other stuff in memory, but i did not use this).

       

      Can anybody confirm this or give me a solution?

       

      I tried so much things, nothing helps, i tried almost all cf9 admin settings.

      Im am creating a lot of cfc's in a batch process, this was no problem on cf8, but now we need 5,5g of memory for this batch process while in the past just needed 1g.

       

      Thanks in advance,

      Klaas-Jan Winkel