take MALLOC_OPTIONS=J into account in slab allocator
This commit is contained in:
parent
6b6ca4b48c
commit
9b84b607d9
3 changed files with 34 additions and 9 deletions
|
@ -58,9 +58,22 @@
|
|||
|
||||
|
||||
#if (NGX_DEBUG_MALLOC)
|
||||
|
||||
#define ngx_slab_junk(p, size) ngx_memset(p, 0xD0, size)
|
||||
|
||||
#else
|
||||
|
||||
#if (NGX_FREEBSD)
|
||||
|
||||
#define ngx_slab_junk(p, size) \
|
||||
if (ngx_freebsd_debug_malloc) ngx_memset(p, 0xD0, size)
|
||||
|
||||
#else
|
||||
|
||||
#define ngx_slab_junk(p, size)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static ngx_slab_page_t *ngx_slab_alloc_pages(ngx_slab_pool_t *pool,
|
||||
|
|
|
@ -18,6 +18,7 @@ extern int ngx_freebsd_kern_ipc_zero_copy_send;
|
|||
|
||||
extern ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
||||
extern ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
||||
extern ngx_uint_t ngx_freebsd_debug_malloc;
|
||||
|
||||
|
||||
#endif /* _NGX_FREEBSD_H_INCLUDED_ */
|
||||
|
|
|
@ -25,6 +25,7 @@ int ngx_freebsd_kern_ipc_zero_copy_send;
|
|||
|
||||
ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
||||
ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
||||
ngx_uint_t ngx_freebsd_debug_malloc;
|
||||
|
||||
|
||||
static ngx_os_io_t ngx_freebsd_io = {
|
||||
|
@ -86,6 +87,16 @@ ngx_debug_init()
|
|||
malloc_options = "J";
|
||||
#endif
|
||||
|
||||
ngx_freebsd_debug_malloc = 1;
|
||||
|
||||
#else
|
||||
char *mo;
|
||||
|
||||
mo = getenv("MALLOC_OPTIONS");
|
||||
|
||||
if (mo && ngx_strchr(mo, 'J')) {
|
||||
ngx_freebsd_debug_malloc = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue