comparison src/http/modules/ngx_http_gzip_filter_module.c @ 2425:3d60d55b9ad0

do not try to align to a page size, allocate just 8K, this is fixes allocation on Cygwin, it reports 64K page size
author Igor Sysoev <igor@sysoev.ru>
date Wed, 24 Dec 2008 12:05:55 +0000
parents 086c20fe2e97
children 76925110cdae
comparison
equal deleted inserted replaced
2424:46d11bff21ef 2425:3d60d55b9ad0
936 void *p; 936 void *p;
937 ngx_uint_t alloc; 937 ngx_uint_t alloc;
938 938
939 alloc = items * size; 939 alloc = items * size;
940 940
941 if (alloc % 512 != 0) { 941 if (alloc % 512 != 0 && alloc < 8192) {
942 942
943 /* 943 /*
944 * The zlib deflate_state allocation, it takes about 6K, 944 * The zlib deflate_state allocation, it takes about 6K,
945 * we allocate 8K. Other allocations are divisible by 512. 945 * we allocate 8K. Other allocations are divisible by 512.
946 */ 946 */
947 947
948 alloc = (alloc + ngx_pagesize - 1) & ~(ngx_pagesize - 1); 948 alloc = 8192;
949 } 949 }
950 950
951 if (alloc <= ctx->allocated) { 951 if (alloc <= ctx->allocated) {
952 p = ctx->free_mem; 952 p = ctx->free_mem;
953 ctx->free_mem += alloc; 953 ctx->free_mem += alloc;