apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Darroch <chr...@pearsoncmg.com>
Subject Re: Changing the order of cleanup for some core objects
Date Tue, 22 Jul 2008 00:00:36 GMT
Bojan Smojver wrote:

> Or you can malloc() the resource container in the constructor (i.e. rec
> in dbd_construct()) and then free() it in destructor. That way you know
> it will outlive anything that may have been whacked.

   Yes, certainly, but now you're no longer using whatever APR
allocator you may have set up for your app, and you've lost any other
nice abstractions APR introduced between you and the OS.  For me
a large part of the value of APR pools is that they take a lot of
the hassle out of memory management -- except, of course, in cases
like this, where they don't.

   I'm going to have to bow out here but I guess my main concern
is that it's not unreasonable for developers to assume APR reslists
and pools should play well together, and they really don't, at
present -- you either have to resort to bare malloc()/free(),
leak memory, or work around the cleanup order problem.

Chris.

-- 
GPG Key ID: 366A375B
GPG Key Fingerprint: 485E 5041 17E1 E2BB C263  E4DE C8E3 FA36 366A 375B


Mime
View raw message