Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Oct 1995 21:05:36 +0100
From:      David James <dwj@agw.bt.co.uk>
To:        Ollivier Robert <roberto@keltia.freenix.fr>
Cc:        hackers@freefall.freebsd.org
Subject:   mirror patch (formerly A moment in the life ...)
Message-ID:  <199510022005.VAA26445@heracles.agw.bt.co.uk>
In-Reply-To: Your message of "Sat, 30 Sep 1995 13:30:22 BST." <199509301230.NAA10098@keltia.freenix.fr>

next in thread | previous in thread | raw e-mail | index | archive | help

> It seems that michael butler said:
> > There is a very substantial memory leak in mirror .. the author sent me
> > replacement ftp.pl and chat.pl modules (~12 months ago) but I suspect that
> > they are still not a part of any release :-(
> 
> Can we  get our hands on these  ones please ?  I  know of a few  people who
> would kill for an even only slighly smaller mirror...

I never received a fix from the author, but I did work out a one line patch
which gets rid of 99% of the problem. The memory leak is in perl itself,
and happens when you use the eval() function. Since mirror does this for
every block of data which it reads from an ftp connection, the process gets
huge quite quickly. The following one line patch helps a lot:

*** /usr/local/mirror/ftp.pl~	Wed Jan 26 14:59:08 1994
--- /usr/local/mirror/ftp.pl	Mon Jun 12 15:25:05 1995
***************
*** 496,502 ****
  		return -1;
  	}
  
! 	local( $ret ) = eval '&timed_read()';
  	alarm( 0 );
  
  	if( $@ =~ /^timeout/ ){
--- 496,502 ----
  		return -1;
  	}
  
! 	local( $ret ) = eval { &timed_read() };
  	alarm( 0 );
  
  	if( $@ =~ /^timeout/ ){

David

email: dwj@agw.bt.co.uk, phone: +44 171 250 6469, fax: +44 171 336 0214
post:  pp8.5a, 207 Old Street, London EC1V 9PS,  U.K.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510022005.VAA26445>