comparison src/core/ngx_slab.c @ 5634:5024d29354f1

Core: slab log_nomem flag. The flag allows to suppress "ngx_slab_alloc() failed: no memory" messages from a slab allocator, e.g., if an LRU expiration is used by a consumer and allocation failures aren't fatal. The flag is now used in the SSL session cache code, and in the limit_req module.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 31 Mar 2014 21:38:30 +0400
parents 79b9101cecf4
children c46657e391a3
comparison
equal deleted inserted replaced
5633:b74f1106f920 5634:5024d29354f1
127 if (m > 0) { 127 if (m > 0) {
128 pages -= m; 128 pages -= m;
129 pool->pages->slab = pages; 129 pool->pages->slab = pages;
130 } 130 }
131 131
132 pool->log_nomem = 1;
132 pool->log_ctx = &pool->zero; 133 pool->log_ctx = &pool->zero;
133 pool->zero = '\0'; 134 pool->zero = '\0';
134 } 135 }
135 136
136 137
656 657
657 return page; 658 return page;
658 } 659 }
659 } 660 }
660 661
661 ngx_slab_error(pool, NGX_LOG_CRIT, "ngx_slab_alloc() failed: no memory"); 662 if (pool->log_nomem) {
663 ngx_slab_error(pool, NGX_LOG_CRIT,
664 "ngx_slab_alloc() failed: no memory");
665 }
662 666
663 return NULL; 667 return NULL;
664 } 668 }
665 669
666 670