Mercurial > hg > nginx
comparison src/os/unix/ngx_darwin_init.c @ 4223:1b779cb69dc8
malloc() debugging on MacOSX.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 24 Oct 2011 15:46:48 +0000 |
parents | 22b05d177dc6 |
children | 003f0f341edf |
comparison
equal
deleted
inserted
replaced
4222:2dd6c7cb211a | 4223:1b779cb69dc8 |
---|---|
11 char ngx_darwin_kern_ostype[16]; | 11 char ngx_darwin_kern_ostype[16]; |
12 char ngx_darwin_kern_osrelease[128]; | 12 char ngx_darwin_kern_osrelease[128]; |
13 int ngx_darwin_hw_ncpu; | 13 int ngx_darwin_hw_ncpu; |
14 int ngx_darwin_kern_ipc_somaxconn; | 14 int ngx_darwin_kern_ipc_somaxconn; |
15 u_long ngx_darwin_net_inet_tcp_sendspace; | 15 u_long ngx_darwin_net_inet_tcp_sendspace; |
16 | |
17 ngx_uint_t ngx_debug_malloc; | |
16 | 18 |
17 | 19 |
18 static ngx_os_io_t ngx_darwin_io = { | 20 static ngx_os_io_t ngx_darwin_io = { |
19 ngx_unix_recv, | 21 ngx_unix_recv, |
20 ngx_readv_chain, | 22 ngx_readv_chain, |
51 &ngx_darwin_kern_ipc_somaxconn, | 53 &ngx_darwin_kern_ipc_somaxconn, |
52 sizeof(ngx_darwin_kern_ipc_somaxconn), 0 }, | 54 sizeof(ngx_darwin_kern_ipc_somaxconn), 0 }, |
53 | 55 |
54 { NULL, NULL, 0, 0 } | 56 { NULL, NULL, 0, 0 } |
55 }; | 57 }; |
58 | |
59 | |
60 void | |
61 ngx_debug_init() | |
62 { | |
63 #if (NGX_DEBUG_MALLOC) | |
64 | |
65 /* | |
66 * MacOSX 10.6, 10.7: MallocScribble fills freed memory with 0x55 | |
67 * and fills allocated memory with 0xAA. | |
68 * MacOSX 10.4, 10.5: MallocScribble fills freed memory with 0x55, | |
69 * MallocPreScribble fills allocated memory with 0xAA. | |
70 * MacOSX 10.3: MallocScribble fills freed memory with 0x55, | |
71 * and no way to fill allocated memory. | |
72 */ | |
73 | |
74 setenv("MallocScribble", "1", 0); | |
75 | |
76 ngx_debug_malloc = 1; | |
77 | |
78 #else | |
79 | |
80 if (getenv("MallocScribble")) { | |
81 ngx_debug_malloc = 1; | |
82 } | |
83 | |
84 #endif | |
85 } | |
56 | 86 |
57 | 87 |
58 ngx_int_t | 88 ngx_int_t |
59 ngx_os_specific_init(ngx_log_t *log) | 89 ngx_os_specific_init(ngx_log_t *log) |
60 { | 90 { |