mirror of
https://github.com/nginx/nginx.git
synced 2024-12-04 22:09:01 +08:00
take MALLOC_OPTIONS=J into account in slab allocator
This commit is contained in:
parent
dc3bbea15c
commit
5e593aa34e
@ -58,9 +58,22 @@
|
|||||||
|
|
||||||
|
|
||||||
#if (NGX_DEBUG_MALLOC)
|
#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
|
#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)
|
#define ngx_slab_junk(p, size)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ngx_slab_page_t *ngx_slab_alloc_pages(ngx_slab_pool_t *pool,
|
static ngx_slab_page_t *ngx_slab_alloc_pages(ngx_slab_pool_t *pool,
|
||||||
|
@ -11,13 +11,14 @@
|
|||||||
ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
|
ngx_chain_t *ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in,
|
||||||
off_t limit);
|
off_t limit);
|
||||||
|
|
||||||
extern int ngx_freebsd_kern_osreldate;
|
extern int ngx_freebsd_kern_osreldate;
|
||||||
extern int ngx_freebsd_hw_ncpu;
|
extern int ngx_freebsd_hw_ncpu;
|
||||||
extern u_long ngx_freebsd_net_inet_tcp_sendspace;
|
extern u_long ngx_freebsd_net_inet_tcp_sendspace;
|
||||||
extern int ngx_freebsd_kern_ipc_zero_copy_send;
|
extern int ngx_freebsd_kern_ipc_zero_copy_send;
|
||||||
|
|
||||||
extern ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
extern ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
||||||
extern ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
extern ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
||||||
|
extern ngx_uint_t ngx_freebsd_debug_malloc;
|
||||||
|
|
||||||
|
|
||||||
#endif /* _NGX_FREEBSD_H_INCLUDED_ */
|
#endif /* _NGX_FREEBSD_H_INCLUDED_ */
|
||||||
|
@ -23,8 +23,9 @@ int ngx_freebsd_machdep_hlt_logical_cpus;
|
|||||||
int ngx_freebsd_kern_ipc_zero_copy_send;
|
int ngx_freebsd_kern_ipc_zero_copy_send;
|
||||||
|
|
||||||
|
|
||||||
ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
ngx_uint_t ngx_freebsd_sendfile_nbytes_bug;
|
||||||
ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
ngx_uint_t ngx_freebsd_use_tcp_nopush;
|
||||||
|
ngx_uint_t ngx_freebsd_debug_malloc;
|
||||||
|
|
||||||
|
|
||||||
static ngx_os_io_t ngx_freebsd_io = {
|
static ngx_os_io_t ngx_freebsd_io = {
|
||||||
@ -86,6 +87,16 @@ ngx_debug_init()
|
|||||||
malloc_options = "J";
|
malloc_options = "J";
|
||||||
#endif
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user