httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Schaefer <joe+gm...@sunstarsys.com>
Subject Re: Newbie: Question
Date Tue, 27 Jun 2006 13:38:25 GMT
"Edward L. Abrams" <abrams@bitscrap.com> writes:

>   // dump the values in this brigade:
>   for (b = APR_BRIGADE_FIRST(bb);
>        b != APR_BRIGADE_SENTINEL(bb);
>        b = APR_BUCKET_NEXT(b))

This is the source of your leak.
What you need to do is copy the upload brigade
and iterate over it using something like


    while (!APR_BRIGADE_EMPTY(bb)) {
       apr_bucket_t *e = APR_BRIGADE_FIRST(bb);

       ...read from the bucket, do something with data...

       apr_bucket_delete(e);
    }


ie, destroy the buckets as you read from them.
reading from file buckets tends to convert those buckets
into heap buckets, and unless you delete them as you go,
you wind up copying the entire spool file into RAM.

-- 
Joe Schaefer


Mime
View raw message