apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: Pools behaviour, WAS: RE: cvs commit: apr-util/test testdbm.c
Date Thu, 23 Aug 2001 10:02:31 GMT
> On Thu, Aug 23, 2001 at 11:04:45AM +0200, Sander Striker wrote:
> > ...
> > Greg> apr_palloc() will never return NULL. No need for such a
> complex test.
> >
> > It won't?  You mean that in httpd there is always an abortfunc present?
> There should be an abortfunc, yes. ISTR once looking and finding it wasn't
> set (but it should).
> APR and httpd and every other APR user that I'm aware of assume that
> apr_palloc and friends succeed or abort. Everything is designed and built
> that way.
> Thus: until we decide to change that assumption, it is useless clutter to
> check for NULL results.

Agreed, that was not the issue I was pointing out.  httpd isn't doing NULL
checking for apr_palloc anywhere, that should be maintained.  However,
this implies that an abort function should be set somewhere.

For applications not setting an abort function there should at least be
the oppurtunity to check for NULL results of apr_palloc.

Applications that set an abort functions can safely assume that apr_palloc
returns something valid or calls the abort function.

AFAIK httpd-2.0 _doesn't_ set an abort function.  I believe Ryan said
something on this a few months back.

> > Oh, I see, you are saying that _without_ an abort
> > function it will segfault due to the marked line?
> I had no idea about that segfault. It is just a typical example of what I
> described above.

Not really.  Pools don't enforce you to set an abort function.  If it isn't
set the pools code shouldn't segfault.

> We can talk on and on about whether that is "appropriate" or not, but it
> isn't going to change in any near or mid term that I could imagine.

Well, the reason I am interested is because I am working on yet another
attempt to optimize the pools code.  Justin ran some 'benchmarks' last
but we need to run them again to be sure there is a performance increase.
If so I'll be posting a patch for review (it also removes the locking issues
we have regarding to the global free list).

In that new code I would like to do what is appropiate and return NULL
when we have no mem and no abort function.


View raw message