take MALLOC_OPTIONS=J into account in slab allocator

This commit is contained in:
Igor Sysoev 2007-12-22 11:06:53 +00:00
parent dc3bbea15c
commit 5e593aa34e
3 changed files with 34 additions and 9 deletions

View File

@ -58,9 +58,22 @@
#if (NGX_DEBUG_MALLOC)
#define ngx_slab_junk(p, size) ngx_memset(p, 0xD0, size)
#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,

View File

@ -11,13 +11,14 @@
ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
off_t limit);
extern int ngx_freebsd_kern_osreldate;
extern int ngx_freebsd_hw_ncpu;
extern u_long ngx_freebsd_net_inet_tcp_sendspace;
extern int ngx_freebsd_kern_ipc_zero_copy_send;
extern int ngx_freebsd_kern_osreldate;
extern int ngx_freebsd_hw_ncpu;
extern u_long ngx_freebsd_net_inet_tcp_sendspace;
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_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_ */

View File

@ -23,8 +23,9 @@ int ngx_freebsd_machdep_hlt_logical_cpus;
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_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
}