apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject Re: Clarification: apr_brigade_split()
Date Wed, 25 Oct 2006 12:54:55 GMT
Graham Leggett wrote:
> On Wed, October 25, 2006 11:48 am, Joe Orton wrote:
>> Correct - does the below read better?
> It does - thank you!
>> apr_brigade_split() should be used extremely carefully since it always
>> allocates a new brigade.  If an output filter is written in such a way
>> that it may call apr_brigade_split() for multiple invocations per
>> response, then it will use memory proportional to response size.
> I am using it to solve the problem of the cache trying to process large
> (by my initial arbitrary definition, anything 5MB and larger) files in one
> go by splitting large file buckets into smaller buckets before processing.
> The 5MB figure should probably be tunable, so that if you have nice fast
> cache disks, you can process bigger blocks and in doing so consume less
> memory during processing.

Nice. Later you should post your solution so others having the same
problem may google it.

I've attached one way of solving it. It "copies" (only the bucket
structure) the file bucket in order to preserve it on the original
brigade. If mmap is supported the new bucket are just splited on the
platform APR_MMAP_LIMIT. Without mmap, it keeps using the same
implicitly created heap bucket.

Davi Arnaut

View raw message