Christoph,

You need to examine the template(s) you run on a schedule and find
out what is eating memory.  The bug is most likely in your template
not in the CF scheduler.  Don't get obsessed with how the OS or CF uses
memory - a correctly coded CFML application or template should be 
'memory
stable'.  That is, under constant load, memory usage should level off
after an initial warm-up period.  If it doesn't, 99 times out of 100 it 
is
because of incorrectly coded CFML.

Try this:
Put the template on a test server, run it by hand 10 times - watch CF 
grow.
Slice the template in half, run it by hand 10 times - does it still 
grow?
Repeat till you eliminate the growth, then isolate what statement you
removed
to stop the memory growth.

FYI - Apache is not multi-threaded, it is multi-process.  Each process 
exits
after serving a certain number to HTTP requests (100 by default I 
think).
This isolates Apache from memory leaks in its code or plug in modules.
It is also slower than a multi-threaded web server (i.e. Netscape, 
IIS).

--
Tom Jordahl
MacroMedia Server Development



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 26, 2001 5:23 AM
To: CF-Linux
Subject: Re: Memory Usage growing.


Hi Tom.

> 
> OK, try this one:
> #define TWENTY_GIG (1024*1024*20)
> main()
> {
>    void *x = malloc(TWENTY_GIG);  /* 20 Gig */
>    memset(x, 0, TWENTY_GIG-1);
>    free(x);
>    sleep(100);
> }
> 
> FYI - Threads are part of the process image.  
> Their memory is part of the whole process.  Just because
> a thread exits doesn't mean the memory it allocated
> goes away.

OK, this I didn't know.

> 
> It clearly sounds to me that the page you run every five minutes
> is the cause of your memory leak.  If it is the only thing running,
> then you have you culprit.

This means that a CFML file that gets requested every 5 minutes just 
eats up
all available memory (and even the complete swap space if we let it run 
long
enough).

I do not yet understand why this happens. If (with Linux) a process
allocates 1 MB, frees it and then malloc's 1 MB again, the first memory
chunk is reused !

Only if the application still uses it and has not freed it this won't 
work.


So what can we do with our regular scripts running all the time ?
The only way to get around this would be a kind of CFFREE - Tag.
Or do you expect some code in this CFML file to make CF think that the 
data
is still needed and so not freeing it ?



On a side note:

Why does apache, a threaded webserver, work so well ?
It never grows above approx 5MB even if it hands out GBytes of data.

I think it will use the standard malloc also.

Thanks for your answer, 

-- 
Christoph Gr�ver, [EMAIL PROTECTED]

Sitepark
Gesellschaft f�r Informationsmanagement mbH
Rothenburg 14-16
D-48143 M�nster

Telefon (0251) 482 65 -50
Telefax (0251) 482 65 -39

http://www.sitepark.de

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-linux%40houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_linux or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to