Memory leak??

1 view
Skip to first unread message

Andrew Bateman

unread,
Aug 9, 2007, 10:17:56 PM8/9/07
to cfaussie
Have just installed CFMX 7.0.2 on a dedicated server and have put it
through its paces with some load testing. This identified what appears
to be a significant memory leak.

To test this, I created a simple page that creates an instance of a
cfc "Test.cfc". I then call a method in Test.cfc which creates 1000
further instances of Test.cfc and adds them to a "var" scoped variable
within the function. Further, I run a loop which executes this 10,
times, meaning that 10,000 instances of "Test" are created for each
request (see listing below). To really spice things up, I execute this
page 20 times in a row, thus creating 1000 * 10 * 20 = 200000
instances of Test.cfc. See listing below.

What I expected to see is RAM usage spiking then dropping off after
each page request, as garbage collection occurs. I am running
SeeFusion, which reports on jvm memory usage by ColdFusion and this
tells me that this is behaving as expected [i.e. memory is allocated/
deallocated from the heap]. However, the Task Manager tells me a
different story. Basically the RAM assigned to Jrun.exe keeps growing
in a linear fashion, until the server runs out of RAM and grinds to a
halt.

Has anyone else experienced a similar issue and if so do you know of a
resolution? it seems a similar problem to that documented by Mike
Schierbel (http://www.schierberl.com/cfblog/index.cfm/2006/10/12/
ColdFusion_memoryLeak_profiler) , but none of the resolutions he
proposed have had any effect on my server.

FYI, running CF Mx 7.0.2 Standard Edition on a single CPU dual core
Xeon with 2GB of RAM. I have also applied the cumulative Hot Fixes for
7.0.2 .


******************************
LISTING
******************************
--------------------------
Application.cfm
--------------------------
<cfapplication name="LoadTesting" sessionmanagement="true">


--------------------------
LoadTest.cfm
--------------------------
<cfparam name="variables.test"
default="#createObject('component','test').init()#" />
<cfset foo = StructNew()>

<cfparam name="session.counter" default="1">

<cfscript>
for (i=1; i LTE 10;i=i+1){
foo[CreateUuid()] = variables.test.LoadTest();
}
</cfscript>
<!--- this should help, but doesn't --->
<cfset StructClear(variables)>
<cfoutput>done #session.counter# iterations</cfoutput>
<cfif session.counter LTE 20>
<cfset session.counter = session.counter + 1>
<cflocation url="LoadTest.cfm">
<cfelse>
<cfset session.counter = 1>
</cfif>

--------------------------
Test.cfc
--------------------------
<cfcomponent output="false">
<cffunction name="init">
<cfreturn this/>
</cffunction>

<cffunction name="LoadTest" returntype="array">
<cfscript >
var ret = ArrayNew(1);
var i=1;
for(i=1;i LTE 1000;i=i+1 ){
ArrayAppend(ret,CreateObject("component","Test").init());
}
return ret;
</cfscript>
</cffunction>
</cfcomponent>

Steve Onnis

unread,
Aug 9, 2007, 11:03:40 PM8/9/07
to cfau...@googlegroups.com
Have you tried this without seefusion running or even installed? From
memory the server monitoring add a lot of overhead to the system

Steve

Andrew Bateman

unread,
Aug 9, 2007, 11:05:00 PM8/9/07
to cfau...@googlegroups.com
Yeah, I only installed SeeFusion so I could get some idea of what was going on with the jvm. The problem existed before I installed SeeFusion.

Andrew

Taco Fleur

unread,
Aug 11, 2007, 4:44:18 AM8/11/07
to cfau...@googlegroups.com
Hi Andrew,
 
Thats not really load testing though is it?
There is no pause anywhere, its nothing like any real requests that would be made this way. You're better of running some load testing tools, there's plenty of them out there, even free ones.

--
*** http://www.clickfind.com.au  
The new Australian search engine for businesses, products and services
*** http://brisbane-web-design.pacificfox.com.au blog
*** Virtual and Dedicated Servers with MS SQL from $250 a month
*** Virtual and Dedicated Servers with registered version of ColdFusion from $350 a month
*** ColdFusion licenses at the lowest price

KC Kuok

unread,
Aug 11, 2007, 5:18:18 AM8/11/07
to cfaussie
Just a little about seefusion, you may have fixed the original "leak"
but seefusion seems to make some stuff run slower, at work this week
it was something to do with verity and seefusion, it is a third party
flash/CF code, and once we took seefusion off it worked as usually,
before it will just keep eating the resources up.

We have had seefusion running on our server with this software for
probably a year now, and suddenly it started going nuts about 2 weeks
ago and we couldnt figure out why, taking off seefusion made the
problems go away. Maybe you should uninstall it since you can't figure
out this leak with seefusion.

Good luck :)

On Aug 10, 1:05 pm, Andrew Bateman <andrew.bate...@newgency.com>
wrote:

Andrew Bateman

unread,
Aug 11, 2007, 7:32:00 PM8/11/07
to cfau...@googlegroups.com
Thanks, I only installed SeeFusion after I diagnosed this problem, to see if it could provide me with any useful information. I have since uninstalled it and the same thing occurs.

Andrew


Andrew Bateman

unread,
Aug 11, 2007, 7:33:00 PM8/11/07
to cfau...@googlegroups.com
Yeah thanks Taco. I have load testing tools available but I was using this approach to prove a point, ie that ColdFusion was not releasing memory. Not so much load testing as death testing.
 
 

Matthew

unread,
Aug 12, 2007, 8:04:07 PM8/12/07
to cfaussie
Hi Andrew,

Did you get an answer to your problem? I can't believe that no one out
there has an answer! Recently we had a similar problem with JRun using
up more and more memory until it would crashed. We played around with
all sorts of things to try to get it fixed. In the end we think it was
as simple as lowering out simultaneous requests from 20 down to 10.
Perhaps try that.

Please post your resolution if you find one.

Cheers
Matthew

On Aug 12, 9:33 am, Andrew Bateman <andrew.bate...@newgency.com>
wrote:

Pat Branley

unread,
Aug 12, 2007, 10:35:53 PM8/12/07
to cfaussie
I think its more a problem with your code - what kind of request
creates 10,000 cfc instances ?

if you see that kind of performance issue in proudction you would have
2 options.
1. refactor the code
2. get better hardware

in this instance (way too many instances junking up memory) id go for
the refactor option, by using caching and pooling to reduce the no. of
instances per request. If i saw too many requests hitting the site id
proly go down the hardware option. If lots of ppl are hitting my site,
hopefully im making money and can afford the hardware upgrade! :)

obviously theres a point that jrun / jvm / java will just grind down
if you create too many of anything in memory. So my response would be
your code isnt a fair test..

also this line of your code looks to be creating a non-scoped object:

ArrayAppend(ret,CreateObject("component","Test").init());

it could be an issue of the garbage collection not working 100% as
expected because of the lack of scope.

I have seen these jrun memory issues in the past and sometimes it will
use heaps of ram to the point the server will fail. However, it doesnt
happen that often in production and when it does its more gradual...

Pat

Taco Fleur

unread,
Aug 13, 2007, 6:03:57 PM8/13/07
to cfau...@googlegroups.com
my point exactly.

Reply all
Reply to author
Forward
0 new messages