]> granicus.if.org Git - php/commitdiff
Fixed bug #21045 (Apache 2 SAPI now supports the mod_php_memory_usage
authorIlia Alshanetsky <iliaa@php.net>
Mon, 30 Dec 2002 23:45:18 +0000 (23:45 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 30 Dec 2002 23:45:18 +0000 (23:45 +0000)
log variable that allows users to log the memory usage of their PHP scripts).

sapi/apache2filter/sapi_apache2.c

index a999369df55ac8e11e5c167c14a08940bd344645..48221cd46ac869c8fb2f17fa103207aaa5dd8920 100644 (file)
@@ -498,6 +498,15 @@ static int php_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
                                zfd.opened_path = NULL;
 
                                php_execute_script(&zfd TSRMLS_CC);
+#ifdef MEMORY_LIMIT
+                               {
+                                       char *mem_usage;
+                                       mem_usage = apr_psprintf(ctx->r->pool, "%u", AG(allocated_memory_peak));
+                                       AG(allocated_memory_peak) = 0;
+                                       apr_table_set(ctx->r->notes, "mod_php_memory_usage", mem_usage);
+                               }
+#endif
                        } else { 
                                zend_syntax_highlighter_ini syntax_highlighter_ini;