From owner-freebsd-bugs Tue Oct 8 22:45:28 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 461B037B401 for ; Tue, 8 Oct 2002 22:45:27 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id F29FE43E42 for ; Tue, 8 Oct 2002 22:45:25 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id PAA09254; Wed, 9 Oct 2002 15:45:19 +1000 Date: Wed, 9 Oct 2002 15:55:23 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Garrett Wollman Cc: freebsd-bugs@FreeBSD.ORG Subject: Re: bin/43810: 'echo' is too big In-Reply-To: <200210081840.g98IeeK0047411@khavrinen.lcs.mit.edu> Message-ID: <20021009151842.D3839-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Tue, 8 Oct 2002, Garrett Wollman wrote: > < said: > > > "main() {}" now uses malloc() because atexit() uses it unconditionally and > > crt1 uses atexit() unconditionally (to do nothing for "main() {}"). > > Given the limitations of the atexit() interface in the first place, I > see no particular reason why atexit() should provide for dynamic > allocation. Then it would might need bloat in the data section to statically allocate a reasonably large table. I guess sbrk() could be used to allocate a fixed table at startup time (the old version used it to grow the table, but had races in the threaded case). If it were really important (hah!) we could play > weak-symbol games. Already done :-). The correct fix is to not use atexit() in crt1.c. This can be done by calling the destructors that are currently set up using atexit() in crt1.c from exit(), either directly or indirectly using function pointer(s) like stdio's __cleanup. __cleanup is basically a lightweight version of atexit(). It was relatively lightweight even before atexit() became relatively heavyweight. Not already done. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message