I'll test it out, but in the mean time I took your brigade fwrite and
a added delete_bucket line and it seem to be much better. I don't
care about the data after it hits the disk, so I delete each bucket
after writing it to the disk. I wish I got this patch the other day
though! I worked many long hours to get that one line workaround I
just mentioned. I'll test out this patch. Thanks!
On 11/14/06, Joe Schaefer <[EMAIL PROTECTED]> wrote:
"Brian McQueen" <[EMAIL PROTECTED]> writes:
> What bucket type is SPOOL? I don't see it as a real bucket type. I'd
> like to try out the patch here, but I can't duplicate it because I
> don't know what a spool bucket is.
See if this patch to library/util.c solves your leak problem.
It compiles, but it's largely untested:
Index: library/util.c
===================================================================
--- library/util.c (revision 474179)
+++ library/util.c (working copy)
@@ -777,11 +777,16 @@
{
struct iovec v[APREQ_DEFAULT_NELTS];
apr_status_t s;
- apr_bucket *e;
+ apr_bucket *e, *first;
int n = 0;
*wlen = 0;
+ apr_bucket_brigade *tmp = apr_brigade_create(bb->p, bb->bucket_alloc);
- for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb);
+ s = apreq_brigade_copy(tmp, bb);
+ if (s != APR_SUCCESS)
+ return s;
+
+ for (e = APR_BRIGADE_FIRST(tmp); e != APR_BRIGADE_SENTINEL(tmp);
e = APR_BUCKET_NEXT(e))
{
apr_size_t len;
@@ -789,6 +794,9 @@
s = apreq_fwritev(f, v, &n, &len);
if (s != APR_SUCCESS)
return s;
+ while ((first = APR_BRIGADE_FIRST(tmp)) != e)
+ apr_bucket_delete(first);
+
*wlen += len;
}
s = apr_bucket_read(e, (const char **)&(v[n].iov_base),
@@ -805,6 +813,8 @@
if (s != APR_SUCCESS)
return s;
*wlen += len;
+ while ((first = APR_BRIGADE_FIRST(tmp)) != e)
+ apr_bucket_delete(first);
}
return APR_SUCCESS;
}
--
Joe Schaefer