Browse Source

Improve memory consumption on chunked output buffering

PHP-4.0.5
Zeev Suraski 25 years ago
parent
commit
a22ada795f
  1. 7
      ext/standard/output.c
  2. 7
      main/output.c

7
ext/standard/output.c

@ -106,7 +106,11 @@ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size)
if (OG(lock)) {
return FAILURE;
}
php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
if (chunk_size) {
php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size);
} else {
php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
}
OG(php_body_write) = php_b_body_write;
return SUCCESS;
}
@ -301,7 +305,6 @@ static void php_ob_append(const char *text, uint text_length)
if (OG(active_ob_buffer).chunk_size
&& OG(active_ob_buffer).text_length >= OG(active_ob_buffer).chunk_size) {
zval *output_handler = OG(active_ob_buffer).output_handler;
uint chunk_size = OG(active_ob_buffer).chunk_size;
if (output_handler) {
output_handler->refcount++;

7
main/output.c

@ -106,7 +106,11 @@ PHPAPI int php_start_ob_buffer(zval *output_handler, uint chunk_size)
if (OG(lock)) {
return FAILURE;
}
php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
if (chunk_size) {
php_ob_init((chunk_size*3/2), chunk_size/2, output_handler, chunk_size);
} else {
php_ob_init(40*1024, 10*1024, output_handler, chunk_size);
}
OG(php_body_write) = php_b_body_write;
return SUCCESS;
}
@ -301,7 +305,6 @@ static void php_ob_append(const char *text, uint text_length)
if (OG(active_ob_buffer).chunk_size
&& OG(active_ob_buffer).text_length >= OG(active_ob_buffer).chunk_size) {
zval *output_handler = OG(active_ob_buffer).output_handler;
uint chunk_size = OG(active_ob_buffer).chunk_size;
if (output_handler) {
output_handler->refcount++;

Loading…
Cancel
Save