diff options
author | Igor Sysoev <igor@sysoev.ru> | 2007-01-09 16:00:57 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2007-01-09 16:00:57 +0000 |
commit | 3a257b3eb913de29ccf279a433c1746af3a06c2c (patch) | |
tree | dba45e5530b801c00c42ae4e920ab2a5408c6dc7 /src/core/ngx_cycle.c | |
parent | a269c82bd585bb21f89c6fd42f9486f222a94150 (diff) | |
download | nginx-3a257b3eb913de29ccf279a433c1746af3a06c2c.tar.gz nginx-3a257b3eb913de29ccf279a433c1746af3a06c2c.zip |
free the unnecessary shared memory
Diffstat (limited to 'src/core/ngx_cycle.c')
-rw-r--r-- | src/core/ngx_cycle.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c index 84be87542..9602e3e1e 100644 --- a/src/core/ngx_cycle.c +++ b/src/core/ngx_cycle.c @@ -594,6 +594,56 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) /* close and delete stuff that lefts from an old cycle */ + /* free the unnecessary shared memory */ + + opart = &old_cycle->shared_memory.part; + oshm_zone = opart->elts; + + for (i = 0; /* void */ ; i++) { + + if (i >= opart->nelts) { + if (opart->next == NULL) { + goto old_shm_zone_done; + } + opart = opart->next; + oshm_zone = opart->elts; + i = 0; + } + + part = &cycle->shared_memory.part; + shm_zone = part->elts; + + for (n = 0; /* void */ ; n++) { + + if (n >= part->nelts) { + if (part->next == NULL) { + break; + } + part = part->next; + shm_zone = part->elts; + n = 0; + } + + if (oshm_zone[i].name.len == shm_zone[n].name.len + && ngx_strncmp(oshm_zone[i].name.data, + shm_zone[n].name.data, + oshm_zone[i].name.len) + == 0) + { + goto live_shm_zone; + } + } + + ngx_shm_free(&oshm_zone[i].shm); + + live_shm_zone: + + continue; + } + +old_shm_zone_done: + + /* close the unnecessary listening sockets */ ls = old_cycle->listening.elts; |