From: hjl@lucon.org (H.J. Lu)
To: aj@suse.de (Andreas Jaeger)
Cc: libc-hacker@sourceware.cygnus.com (GNU C Library)
Subject: Re: Problem with __malloc_hooks :-(
Date: Thu, 28 Oct 1999 08:43:00 -0000 [thread overview]
Message-ID: <19991028154315.11DF51B493@ocean.lucon.org> (raw)
In-Reply-To: <u8vh7rval7.fsf@gromit.rhein-neckar.de>
>
>
> The following program shows a problem I noticed with a current glibc
> 2.1.3 CVS versions and XEmacs [1]:
>
> #define _GNU_SOURCE
> #include <stdlib.h>
> #include <malloc.h>
>
> int
> main (int argc, char argv[])
> {
> char *p;
>
> if (argc == 1)
> {
> __malloc_hook = NULL;
> __realloc_hook = NULL;
> __free_hook = NULL;
> }
>
> p = malloc (1000);
> printf ("%p\n", p);
> return 0;
> }
>
> Have a look at the output:
>
> gromit:/tmp:[0]$ ./malloc
> (nil)
> gromit:/tmp:[0]$ ./malloc 1
> 0x8049670
>
> If __malloc_hook is NULL, malloc returns NULL. The problem is that
> malloc internally uses __malloc_hook and the current CVS version
> doesn't call malloc before main any more :-(.
>
> Wolfram, can you give me some feedback, please?
>
Ulrich, I have verified that my preinit patch works fine. It seems that
my patch has more than one benefit. Maybe it should be considered
instead of your patch to exit/atexit.
--
H.J. Lu (hjl@gnu.org)
next parent reply other threads:[~1999-10-28 8:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <u8vh7rval7.fsf@gromit.rhein-neckar.de>
1999-10-28 8:43 ` H.J. Lu [this message]
[not found] <m3so2vjxz4.fsf@localhost.localnet>
1999-10-28 8:47 ` H.J. Lu
1999-10-28 8:53 ` Ulrich Drepper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19991028154315.11DF51B493@ocean.lucon.org \
--to=hjl@lucon.org \
--cc=aj@suse.de \
--cc=libc-hacker@sourceware.cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).