ColdFusion 7 Memory Leak


In working on Financial Peace University Online last year, I became aware of a really ugly memory leak that had developed in the app (thankfully it was still in development, not in production). It took a few days to track down, but when I found it, it proved to have some implications that applied to all our ColdFusion web apps.

First I’ll describe the environment:

I discovered that for each singleton instance of a cfc that the ColdSpring factories provided, a little memory was leaked and never garbage collected. I simplified things to remove Mach-II, ColdSpring, and eventually everything except the simplest form I could think of. A cfm would create an instance of a cfc that had a method in it that would return a reference to itself. Then the cfm would go through 100 iterations of calling that method and place the result in an array. So I would have an array with 100 references to the same object, and still, the memory leak was present.

Finally I noticed that on my cfc method, I hadn’t specified output=”false”, though I had specified it on the cfcomponent tag. Adding output=”false” to the method that returned a reference to the cfc cured the memory leak. It seems bizarre, but if a memory leak was obvious, it wouldn’t have made it into the release version of ColdFusion.



5 Responses to “ColdFusion 7 Memory Leak”

  1. cfindex Says:


    It is very attractive site.

    it improve my performence.

    this site is nice and very helpful.

    Interesting series and many good points.
    very nice blog…..

  2. Jim Says:

    Thanks for the good information.

    I’m curious though. What if you have a method that does produce output? Will setting output=”true” leak memory or does the leak only exist if the parameter is not set?

    Also, how have you been testing for memory leaks. I have been dealing with similar issues but have been having a hard time tracking down the culprit. It seems there are a lot of people struggling with memory leaks in CF 7 and it seems that everyone is coming to different conclusions.

  3. mrtroy Says:

    Jim, thanks for the comment. I can’t say if it’s just the act of setting the output parameter that eliminates the memory leak as I only tested by setting it to false.

    As for how I tested, I used the method detailed in this post by my co-worker:

  4. Peter J. Farrell Says:

    Just wanted to say you guy rock! (Glad to have met you guys from Dave Ramsey at BFusion/BFlex). Just wanted to let you know that this post helped me diagnose a memory leak in Mach-II (when reloading from the dashboard). It appears that this issue affect CF8 even with cumulative hot fix 3 which supposedly fixed a memory leak issue CFCs and memory scopes.

    Also beware that I had to fix a bunch of missing output attributes in our ColdSpring copy as well. I’ll post a blog post about this later.

  5. Kunal Says:

    This issue was fixed in Cumulative Hot fix 4 for ColdFusion 8.0.1. You can download it from here:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: