Mail Archives: djgpp-workers/2003/03/18/01:55:14
> Date: Mon, 17 Mar 2003 10:16:49 -0500
> From: CBFalconer <cbfalconer AT yahoo DOT com>
> >
> > The __libc_malloc_fail_hook would be called, if the realloc call were actually
> > failing. So you can find out whether realloc fails, but not in the realloc
> > hook itself.
>
> There is a big fallacy here - i.e. that malloc and free are
> actually called.
The hooks could be called, in the proper places, even if their
``parent'' functions are not. That is, even if realloc doesn't call
malloc, the malloc hook could be called where realloc produces the new
block, and malloc-fail hook could be called if realloc or one of its
subroutines fail.
In any case, some actual use of those hooks is required to make
meaningful judgement about their utility. The only use that I know
of is the implementation of malloc-debug API (which was the original
motivation for adding the hooks); that implementation did not need
any special info about realloc's so the hooks in that area might need
further work. Only some real-life use will tell.
> Also the "4 bytes" is not accurate, and makes an unwarrented
> connection to the actual implementation.
Of course it does! The libc documentation is not an abstract standard
document, it documents the specific implementation. So it should
mention any details that are important for the user of these
functions. If the implementation changes, the docs should be amanded
as well.
> Look at the description of malloc_debug, for example. It is full
> of implementation details
That's intended, see above for the rationale.
> and lacking in functional details. Are
> the reports to stdout, stderr, or some logging file? I take the
> last back - it does say stderr.
So what functional details _are_ missing, actually? I'd like to
improve the docs as much as possible, so please do provide
constructive criticism. TIA
> Adding that back would avoid ANY need for 400 kb auxiliary
> storages and intrinsic limits.
The storage size is tunable without rebuilding the library (via an
environment variable), as the docs explains. Any implementation will
need some storage to record every allocation. So I don't understand
what you are saying here in practical terms.
- Raw text -