From owner-freebsd-current@FreeBSD.ORG Thu Oct 7 18:10:25 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CEA9316A4CE for ; Thu, 7 Oct 2004 18:10:25 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 22BD643D2D for ; Thu, 7 Oct 2004 18:10:10 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i97IA2wC072779; Thu, 7 Oct 2004 21:10:02 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 52629-12; Thu, 7 Oct 2004 21:10:02 +0300 (EEST) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i97IA1BU072776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 7 Oct 2004 21:10:01 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id i97IA6X3084764; Thu, 7 Oct 2004 21:10:06 +0300 (EEST) (envelope-from ru) Date: Thu, 7 Oct 2004 21:10:06 +0300 From: Ruslan Ermilov To: Dan Nelson Message-ID: <20041007181006.GC84576@ip.net.ua> References: <20041004171422.GK262@numachi.com> <20041004172224.GA30419@dan.emsphone.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="nmemrqcdn5VTmUEE" Content-Disposition: inline In-Reply-To: <20041004172224.GA30419@dan.emsphone.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ip.net.ua cc: freebsd-current@freebsd.org Subject: Re: awk leaking memory during arithmetic? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2004 18:10:26 -0000 --nmemrqcdn5VTmUEE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 04, 2004 at 12:22:24PM -0500, Dan Nelson wrote: > In the last episode (Oct 04), Brian Reichert said: > > I may be misremembering some awk lore, but this still seems like > > undesired behavior. Essentially, I'm trying to sum up some numbers, > > but awk spin, chewing up memory, until it drops a huge core file. > >=20 > > # uname -a > > FreeBSD backup.internal 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #1: Mon S= ep 27 > > 19:27:46 EDT 200 root@backup2.internal:/usr/src/sys/i386/compile/FIL= ESERVER i386 > > =20 > > # cat test_list | awk '{print $1}' > > 53999616 > > 53999616 > > 53311488 > > 102475776 > > 257134592 > > 858624 > > 512909312 > > 1147392 > > 39385174 > > 35815424 > >=20 > > # cat test_list | awk '{ t +=3D $1 } END {print $t}' > > awk in malloc(): error: allocation failed >=20 > I think "print t" is what you want here. $t would refer to the t'th > field in the line, and it looks like awk tried to resize the array out > to 1111037014 entries and failed. >=20 There's an open PR bin/72370 on this (now with the patch). Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --nmemrqcdn5VTmUEE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBZYZ+qRfpzJluFF4RAjlKAJ9BGrnH4om7oVoCIe8dwiON5ulKAwCcDjHG qukxP/UwTbS+r8B1vsiDBcM= =UEy1 -----END PGP SIGNATURE----- --nmemrqcdn5VTmUEE--