From owner-freebsd-hackers Mon Oct 2 13:06:12 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id NAA19850 for hackers-outgoing; Mon, 2 Oct 1995 13:06:12 -0700 Received: from zaphod.axion.bt.co.uk (zaphod.axion.bt.co.uk [132.146.5.1]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id NAA19845 for ; Mon, 2 Oct 1995 13:06:06 -0700 Received: from heracles.agw.bt.co.uk by zaphod.axion.bt.co.uk with SMTP (PP); Mon, 2 Oct 1995 21:05:30 +0100 Received: from localhost (localhost [127.0.0.1]) by heracles.agw.bt.co.uk (8.6.9/8.6.9) with SMTP id VAA26445; Mon, 2 Oct 1995 21:05:37 +0100 Message-Id: <199510022005.VAA26445@heracles.agw.bt.co.uk> X-Authentication-Warning: heracles.agw.bt.co.uk: Host localhost didn't use HELO protocol To: Ollivier Robert cc: hackers@freefall.freebsd.org Subject: mirror patch (formerly A moment in the life ...) In-reply-to: Your message of "Sat, 30 Sep 1995 13:30:22 BST." <199509301230.NAA10098@keltia.freenix.fr> Date: Mon, 02 Oct 1995 21:05:36 +0100 From: David James Sender: owner-hackers@FreeBSD.org Precedence: bulk > 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.