Re: FCGI/perl memory leakage

Sven Verdoolaege (
Wed, 2 Apr 1997 15:03:53 +0200

Message-Id: <>
Date: Wed, 2 Apr 1997 15:03:53 +0200
From: (Sven Verdoolaege)
Subject: Re: FCGI/perl memory leakage
In-Reply-To: <>; from Sven Verdoolaege on Apr 1, 1997 20:23:04 +0200

On Apr 1, (Sven Verdoolaege) wrote:
> On Mar 31, damon@netserver.Stanford.EDU (Conrad Damon) wrote:
> > Hi folks,
> > 
> > I'm working on porting some of our cgi-bin scripts to FastCGI and have found 
> > that no matter how small the script, the fastcgi process seems to grow. My 
> > setup is SunOS, perl5.00395, FCGI 0.28, apache 1.2.
> > 
> > Watching the process via top, it grows by 4K every 3 or 4 requests. This 
> > happens even with tiny-perl-fcgi (which allocates only one variable), so it 
> > wouldn't seem to be the app code. The only other place I can think it might be 
> > happening is in the FCGI module. Any ideas? Has anyone else noticed this? The 
> > solution for now is to just kill off the app after x requests (remembering to 
> > call FCGI::finish). Watched one of the C examples, and it didn't grow at all.
> No one has ever reported this. If I find the time, I'll have a look.
> I you or anyone (some one with Purify, for example) can pinpoint
> the leakage, please let me know.

I think I've located the problem.
perl is trying to be smart and postpones the desruction of hash elements
till ... never in this case.
Quick solution is to uncomment the hv_delete in line 172 of FCGI.xs .
This may have unwanted side effects.
Complete solution will take some more time and someone (Stanley ?)
to explain to me what all this environment stuff is supposed to do.