Welcome! Log In Create A New Profile

Advanced

Re: fix ngx_reset_pool

Maxim Dounin
July 18, 2016 02:52PM
Hello!

On Tue, Jul 19, 2016 at 12:38:58AM +0800, 梁思健 wrote:

> # HG changeset patch
> # User Liang Sijian <liangsijian@foxmail.com>
> # Date 1468859189 -28800
> # Tue Jul 19 00:26:29 2016 +0800
> # Node ID 45ef1e0a48a82b2a81db6bc447aaeb16a10056f9
> # Parent 6acaa638fa074dada02ad4544a299584da9abc85
> fix ngx_reset_pool
>
> diff --git a/src/core/ngx_palloc.c b/src/core/ngx_palloc.c
> --- a/src/core/ngx_palloc.c
> +++ b/src/core/ngx_palloc.c
> @@ -109,7 +109,8 @@ ngx_reset_pool(ngx_pool_t *pool)
> }
>
> for (p = pool; p; p = p->d.next) {
> - p->d.last = (u_char *) p + sizeof(ngx_pool_t);
> + p->d.last = (u_char *) p +
> + (p == pool ? sizeof(ngx_pool_t ) : sizeof(ngx_pool_data_t));
> p->d.failed = 0;
> }

A previous attempt to "fix" this can be found here, it looks
slightly better from my point of view:

http://mailman.nginx.org/pipermail/nginx-devel/2010-June/000351.html

Though we are quite happy with the current code, while it is not
optimal - it is simple and good enough from practical point of
view.

--
Maxim Dounin
http://nginx.org/

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

fix ngx_reset_pool

梁思健 July 18, 2016 12:40PM

Re: fix ngx_reset_pool

Maxim Dounin July 18, 2016 02:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
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