Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 15:55:23 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Garrett Wollman <wollman@lcs.mit.edu>
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/43810: 'echo' is too big
Message-ID:  <20021009151842.D3839-100000@gamplex.bde.org>
In-Reply-To: <200210081840.g98IeeK0047411@khavrinen.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 8 Oct 2002, Garrett Wollman wrote:

> <<On Tue, 8 Oct 2002 01:00:02 -0700 (PDT), Bruce Evans <bde@zeta.org.au> 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




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