apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: apr_dbd: a generic SQL wrapper
Date Fri, 10 Dec 2004 02:16:36 GMT
Garrett Rooney wrote:

> Nick Kew wrote:
>
>> On Thu, 9 Dec 2004, Garrett Rooney wrote:
>>
>>
>>> This really seems kind of odd, and I'm wondering if it's just 
>>> because of
>>> my Subversion background.  So the cleanup that closes the connection is
>>> registered with the first pool, but the dbd is actually allocated 
>>> out of
>>> the second?
>>
>>
>>
>> No, the second is for temporary stuff.  The mysql driver uses it
>> to parse the params string into strings that can be passed to
>> mysql_real_connect.  There's an assumption in there that the
>> driver itself won't be allocating anything long-lasting on a pool.
>
>
> But it's temporary allocation.  You create a temp subpool at the 
> beginning of the function, use it for the parsing and whatnot, then 
> kill the pool at the end.  Yes, there is some temporary allocation 
> from the long lived pool, but the memory is available for other use as 
> soon as the function is over.  I don't see why a second pool is needed.

Also, if you happen to miss something, the temp subpool will die anyway 
when the parent pool's cleanup is called. Suspenders and belt are good.

-- Brane



Mime
View raw message