Welcome! Log In Create A New Profile

Advanced

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

December 23, 2010 02:16AM
On Thu, Dec 23, 2010 at 01:46:15AM -0500, garry.lgr wrote:

> [img]http://blog.chinaunix.net/photo/6889_101223144343.jpg[/img]
> I drawed a picture according to the code of the nginx-0.9.1. The top
> part in the picture is built in the ngx_http_block of ngx_http.c.
>
> When the ngx_http_merge_servers function at line 277 is called, the
> ctx->srv_conf have hold the address of cf->ctx->srv_conf. After
> ctx->srv_conf = cscfp[s]->ctx->srv_conf, ctx->srv_conf discard it's
> older address to point to the new address cscfp[s]->ctx->srv_conf.

Think ctx->srv_conf like a hidden function parameter available via cf->ctx:

merge_srv_conf(cf, [ cf->ctx->srv_conf ], ...

> So I think it will generate memory leak.

All memory operated in ngx_http.c and many other files are allocated
from memory pools freed at once. For example, memory in ngx_http.c
is freed after each reconfiguration.


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

eagle sbc December 22, 2010 10:54PM

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

garry.lgr December 23, 2010 01:46AM

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

Igor Sysoev December 23, 2010 02:16AM

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

garry.lgr December 23, 2010 02:51AM

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

Igor Sysoev December 23, 2010 03:50AM

Re: what's the meaning ? ctx->srv conf = cscfp[s]->ctx->srv conf

garry.lgr December 23, 2010 05:09AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 203
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready