On Thu, Aug 20, 2015 at 4:12 AM, GHui <[email protected]> wrote: > > On Thu, 2015-08-20 at 6:30 AM , Nick wrote: > >>Can you not solve that problem by using a subpool for those >>functions? That way you can give the subpool the lifetime >>you need it to have, regardless of other resources that >>prevent you clearing the parent pool. > > > If do this, every connect need create a subpool, and clear mpool when close > the connect.
Pools can be recycled in an aside list (or APR_RING), after being cleared (which closes the socket), so that the next connections will either reuse an existing/idle pool or create a new one (lately recycled). You may also use an apr_reslist of pools if you need synchronization and native parameters to handle the pools' limits/lifetime in the list. This both ovoids leaks and becomes optimaly efficient once the maximum number of connections have been reached (all pools are reused).
