Skip navigation
Currently Being Moderated

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

Jul 10, 2012 2:59 PM

Tags: #memory #9 #leak #tool #collection #coldfusion #cfc #analysis #garbage #cfdummycomponent #unreferenced #variablescope #visualvm

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

 
Replies
  • Currently Being Moderated
    Jul 12, 2012 5:37 AM   in reply to elklaaso

    I have run your code on CF 10. At no time did total server memory usage go beyond several hundred MB.

     

    You should not accept or expect this behaviour on CF9.x. Report it as a bug. Writing such a report will also compel you to rule out any other process that might be consuming the memory.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 13, 2012 12:52 AM   in reply to elklaaso

    I have also added my voice to the bugbase, appealing for the issue to be reopened until it is resolved in CF 9.0.1.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 13, 2012 1:32 AM   in reply to BKBK

    Yeah, I've voted too.  Cheers for raising this.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 14, 2012 5:27 AM   in reply to elklaaso

    voted

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points