httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: Changing the ap_strerror prototype
Date Fri, 21 Apr 2000 20:31:41 GMT
rbb@apache.org wrote:
> 
> On Fri, 21 Apr 2000, Ben Laurie wrote:
> 
> > rbb@covalent.net wrote:
> > >
> > > I lost the original thread (sorry).
> > >
> > > Rather then changing the ap_strerror prototype to take a buffer and a
> > > length, why don't we fix the actual problem and fix our memory allocation
> > > scheme?
> > >
> > > The problem was brought up with pools not being right when APR was first
> > > started.  At the time, Dean proposed a possible solution to the problem,
> > > using pools to implemented mallc/free, palloc, and shared memory
> > > palloc.
> > >
> > > Take a look through the archives, and lets stop fixing these things one at
> > > a time and fix it for good.  This scheme would allow us to pass in a
> > > single pool, and allocate memory correctly whenever we need it.
> >
> > The problem is freeing. Either you create a new pool, explicitly free or
> > leak. None of those are preferable to passing a buffer and a length, in
> > many case. This is one of those cases, IMO. There's also the efficiency
> > thing, but that hardly applies to this particular function.
> 
> I know what the problem is.  Dean's proposal from a year ago handled this
> case, by allowing people to allocate and free from within a pool.

That's "explicitly free" as I said. In this case, passing a buffer is
better, IMO.

For the record, I have nothing against the ability to explicitly free in
pools, though they'd have to be pools designed for that purpose, so it
is hard to see how that would improve on the "create a new pool which
you destroy immediately" solution in this case.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

Mime
View raw message