Mercurial > hg > nginx-quic
changeset 1207:103988cef757
use memory optimization for i386 and amd64 only:
this fixes SIGBUS in PCRE on sparc64
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 21 May 2007 13:49:35 +0000 |
parents | 451e34738078 |
children | 5eae5751507f |
files | src/core/ngx_palloc.c |
diffstat | 1 files changed, 12 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/ngx_palloc.c +++ b/src/core/ngx_palloc.c @@ -97,10 +97,21 @@ ngx_palloc(ngx_pool_t *pool, size_t size for ( ;; ) { +#if (NGX_HAVE_NONALIGNED) + + /* + * allow non-aligned memory blocks for small allocations (1, 2, + * or 3 bytes) and for odd length strings (struct's have aligned + * size) + */ + if (size < sizeof(int) || (size & 1)) { m = p->last; - } else { + } else +#endif + + { m = ngx_align_ptr(p->last, NGX_ALIGNMENT); }