[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Brigade memory lifetime & leaks

On Tue, Jun 5, 2018 at 1:54 PM, Yann Ylavic <ylavic.dev@xxxxxxxxx> wrote:
> On Tue, Jun 5, 2018 at 1:51 PM, Stefan Eissing
> <stefan.eissing@xxxxxxxxxxxxx> wrote:
>>> Am 05.06.2018 um 13:50 schrieb Yann Ylavic <ylavic.dev@xxxxxxxxx>:
>>> On Tue, Jun 5, 2018 at 1:26 PM, Stefan Eissing
>>> <stefan.eissing@xxxxxxxxxxxxx> wrote:
>>>>> Am 05.06.2018 um 10:46 schrieb Joe Orton <jorton@xxxxxxxxxx>:
>>>>> Another choice is to allocate the brigade structure using the bucket
>>>>> allocator and actually free it on _destroy().  Anybody around who can
>>>>> remember why we used a pool allocation for that structure from the
>>>>> beginning?
>>>> How about having the apr_bucket_brigade struct on the stack as an option?
>>> I had similar issue for r1822596 and proposed to have a c->tmpbb
>>> available (to be cleared after use, there are several similar places
>>> where it could be useful), but the semantic wasn't really accepted so
>>> Rüdiger proposed to use c->notes to create that brigade once only
>>> where needed.
>>> It could work I think here too.
>> How to avoid using the ->tmpbb in two locations on the "pass it" stack? Is it clear which code will use it?
> Yes this is clearly a good to not have accepted it :)

A "stack" of c->tmpbbs to acquire/release could work, maybe a bit
overkill, but the more needs like this the less overkill (IMHO).