httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject Re: graceful restarts, take 5
Date Tue, 22 Apr 1997 17:55:21 GMT
Ack, I got my one change wrong ...

>***************
>*** 201,206 ****
>--- 199,210 ----
>  
>    /* Nope. */
>  
>+   if (min_size + BLOCK_MINFREE < BLOCK_MINALLOC) {
>+     min_size = BLOCK_MINALLOC;
>+   } else {
>+     min_size += BLOCK_MINALLOC;
>+   }
>+ 
>    return malloc_block (min_size);
>  }

Should instead be just (without the if statement)

   return malloc_block((min_size > BLOCK_MINALLOC) ? min_size : BLOCK_MINALLOC);

The reason is that there is no real benefit to creating huge free areas
inside a new block other than for reducing the number of malloc calls when
lots of small pcalloc requests are made.  For large-scale memory requests,
it is more important to be conservitive in malloc, since that type of block
is more likely to be quickly deallocated by the process (e.g., subrequests).
Depending on the system page size, it is also considerably more expensive
to allocate 8KB+1 bytes than just 8KB.

Note also that this optimization should be considered separately from
the rest of the patch -- everything else is straight bug fixes.

.....Roy

Mime
View raw message