comparison src/core/ngx_cycle.c @ 995:4b0d9e2b31c6

free the unnecessary shared memory
author Igor Sysoev <igor@sysoev.ru>
date Tue, 09 Jan 2007 16:00:57 +0000
parents 151ae1691971
children 7fdcb5b9f063
comparison
equal deleted inserted replaced
994:151ae1691971 995:4b0d9e2b31c6
592 } 592 }
593 593
594 594
595 /* close and delete stuff that lefts from an old cycle */ 595 /* close and delete stuff that lefts from an old cycle */
596 596
597 /* free the unnecessary shared memory */
598
599 opart = &old_cycle->shared_memory.part;
600 oshm_zone = opart->elts;
601
602 for (i = 0; /* void */ ; i++) {
603
604 if (i >= opart->nelts) {
605 if (opart->next == NULL) {
606 goto old_shm_zone_done;
607 }
608 opart = opart->next;
609 oshm_zone = opart->elts;
610 i = 0;
611 }
612
613 part = &cycle->shared_memory.part;
614 shm_zone = part->elts;
615
616 for (n = 0; /* void */ ; n++) {
617
618 if (n >= part->nelts) {
619 if (part->next == NULL) {
620 break;
621 }
622 part = part->next;
623 shm_zone = part->elts;
624 n = 0;
625 }
626
627 if (oshm_zone[i].name.len == shm_zone[n].name.len
628 && ngx_strncmp(oshm_zone[i].name.data,
629 shm_zone[n].name.data,
630 oshm_zone[i].name.len)
631 == 0)
632 {
633 goto live_shm_zone;
634 }
635 }
636
637 ngx_shm_free(&oshm_zone[i].shm);
638
639 live_shm_zone:
640
641 continue;
642 }
643
644 old_shm_zone_done:
645
646
597 /* close the unnecessary listening sockets */ 647 /* close the unnecessary listening sockets */
598 648
599 ls = old_cycle->listening.elts; 649 ls = old_cycle->listening.elts;
600 for (i = 0; i < old_cycle->listening.nelts; i++) { 650 for (i = 0; i < old_cycle->listening.nelts; i++) {
601 if (ls[i].remain) { 651 if (ls[i].remain) {