Hi,
when a file is opened using apr_file_open with the flag
APR_FOPEN_BUFFERED, a 4096 bytes buffer is allocated in the pool.
4096 is the half of a "pool block", so it often leads to the allocation
of a new 8k block.
When opening .htaccess files, the APR_FOPEN_BUFFERED flag is set but in
most cases, I think that this file is much smaller than 4096 bytes.
This lead to potentially allocating much more memory than useful in the
request pool.
Do you think it would be interesting to teach apr_file_open to allocate
max(size of the file, 4096) when opening small files with
APR_FOPEN_BUFFERED set ?
I expect .htaccess file to be a few hundreds of byte. So this would save
~ 3 ko in the request pool.
CJ
- APR_FOPEN_BUFFERED and small files Christophe JAILLET
-