You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by jo...@sunstarsys.com on 2000/06/29 09:00:39 UTC

multipart_buffer patch for libapreq

Here's another patch for libapreq that should help keep 
Apache::Request from hogging memory during large file uploads.

The 2 main problems with the multipart_buffer code are

1) the loop in multipart_buffer_fill needs "optimizing".

   The my_join call (line 142 in multipart_buffer.c) mallocs
   a brand new buffer with each pass of the loop. This is BAD.

2) multipart_buffer_read (line 225 in multipart_buffer.c) mallocs 
   with each function call. 

   A large file upload calls this code repeatedly 
   (427-430 inapache_request.c), so you wind up shoving another 
   copy of the entire file into r->pool.

Here's the patch. I parsed a 50M file with it using Apache::Request,
but that's about the full extent to which it's been tested.