[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: return value of apr_palloc

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-08-15 00:14:51 CEST

On Sat, Aug 12, 2000 at 02:34:05AM +0100, Joe Orton wrote:
> On Fri, Aug 11, 2000 at 06:27:04PM -0700, Greg Stein wrote:
> > If any of the ap_palloc(), ap_pcalloc(), etc return, then it succeeded. You
> > will never see an "out of memory" error.
>
> This was true in Apache 1.3 but I don't think it's true in APR... as far
> as I can see, you have to explicitly register an "apr_abort" function
> with the pool, else the *alloc functions will just return NULL if
> malloc() ever returns NULL.

That is the theory. If it isn't done now, then Subversion should be
registering an abort function that does an abort() or exit().

Why "theory"? Because APR makes the same assumption about allocations :-) In
other words, if you attempt to /not/ abort on a malloc() failure, then APR
is going to fall down.

> And you can't seem to register an apr_abort function using
> apr_create_pool, only with make_sub_pool... which seems wrong; maybe I'm
> missing something.

Oh, probably not. The apr_abort thing was (IMO) added in there simply to
satisfy the purists that said APR should never call exit/abort itself, but
should leave it to the app.

In reality, the app must always register an exit/abort function.

This behavior/design actually makes sense for Subversion, so there aren't
any plans to attempt any recovery on a memory failure.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:06 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.