ASF Bugzilla – Attachment 25431 Details for
Bug 49276
mod_cgi allocates unnecessary amounts of memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to reduce memory usage of mod_cgi.
httpd-2.2.15-cgi-memwaste.diff (text/plain), 1.37 KB, created by
Andreas Krennmair
on 2010-05-12 09:24:59 UTC
(
hide
)
Description:
patch to reduce memory usage of mod_cgi.
Filename:
MIME Type:
Creator:
Andreas Krennmair
Created:
2010-05-12 09:24:59 UTC
Size:
1.37 KB
patch
obsolete
>diff -urN httpd-2.2.15.orig/modules/generators/mod_cgi.c httpd-2.2.15/modules/generators/mod_cgi.c >--- httpd-2.2.15.orig/modules/generators/mod_cgi.c 2007-07-17 19:16:09.000000000 +0200 >+++ httpd-2.2.15/modules/generators/mod_cgi.c 2010-05-08 21:57:41.000000000 +0200 >@@ -627,17 +627,15 @@ > static apr_status_t cgi_read_stdout(apr_bucket *a, apr_file_t *out, > const char **str, apr_size_t *len) > { >- char *buf; >+ char buf[APR_BUCKET_BUFF_SIZE]; > apr_status_t rv; > > *str = NULL; >- *len = APR_BUCKET_BUFF_SIZE; >- buf = apr_bucket_alloc(*len, a->list); /* XXX: check for failure? */ >+ *len = sizeof(buf); > > rv = apr_file_read(out, buf, len); > > if (rv != APR_SUCCESS && rv != APR_EOF) { >- apr_bucket_free(buf); > return rv; > } > >@@ -646,14 +644,12 @@ > apr_bucket_heap *h; > > /* Change the current bucket to refer to what we read */ >- a = apr_bucket_heap_make(a, buf, *len, apr_bucket_free); >+ a = apr_bucket_heap_make(a, buf, *len, NULL); > h = a->data; >- h->alloc_len = APR_BUCKET_BUFF_SIZE; /* note the real buffer size */ >- *str = buf; >+ *str = h->base; > APR_BUCKET_INSERT_AFTER(a, cgi_bucket_dup(data, a->list)); > } > else { >- apr_bucket_free(buf); > a = apr_bucket_immortal_make(a, "", 0); > *str = a->data; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 49276
: 25431