From 2517fbf2b8e2306b83102ffeda0c54b5a15780a3 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Mon, 21 May 2007 13:49:35 +0000 Subject: use memory optimization for i386 and amd64 only: this fixes SIGBUS in PCRE on sparc64 --- src/core/ngx_palloc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/core/ngx_palloc.c') diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c index 4288bf10a..2e72a0f3b 100644 --- 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); } -- cgit v1.2.3