__uc_malloc hooks
Denys Vlasenko
vda.linux at googlemail.com
Mon Sep 17 22:09:01 UTC 2007
On Monday 17 September 2007 18:43, Rob Landley wrote:
> On Monday 17 September 2007 10:08:37 am Dave Dodge wrote:
> > On Mon, Sep 17, 2007 at 11:00:23AM +0100, Denys Vlasenko wrote:
> > > On Monday 17 September 2007 05:03, Rob Landley wrote:
> > > > That said, testing for NULL is seldom useful because attempts to use
> > > > the result give you a nice null pointer dereference and a segfault,
> > > > cleanly ending the program anyway.
> > >
> > > For libc, this is not acceptable.
> >
> > Yeah, this sort of abort-on-oom behavior is exactly what keeps me from
> > using glibc's fancy features. For example the obstack API aborts on
> > OOM by default. It does give the ability to set an error handler, but
> > that's still really not good enough because the programs where I
> > actually _care_ about these errors tend to be heavily threaded.
>
> Lemme clarify: the correct thing for uClibc to do when it can't allocate
> requested memory is to return either NULL or -ENOMEM back to the calling
> program as appropriate. It's then userspace's job to test for NULL
> or -ENOMEM.
__uc_malloc does not replace malloc. It is used *only* when we cannot return
error notification to user, as described in previous mail.
--
vda
More information about the uClibc
mailing list