Welcome! Log In Create A New Profile

Advanced

[nginx] Core: improved ngx_reset_pool() (ticket #490).

Maxim Dounin
January 17, 2014 10:54AM
details: http://hg.nginx.org/nginx/rev/320abeb364e6
branches:
changeset: 5521:320abeb364e6
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Jan 17 06:24:53 2014 +0400
description:
Core: improved ngx_reset_pool() (ticket #490).

Previously pool->current wasn't moved back to pool, resulting in blocks
not used for further allocations if pool->current was already moved at the
time of ngx_reset_pool(). Additionally, to preserve logic of moving
pool->current, the p->d.failed counters are now properly cleared. While
here, pool->chain is also cleared.

This change is essentially a nop with current code, but generally improves
things.

diffstat:

src/core/ngx_palloc.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diffs (20 lines):

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
@@ -105,11 +105,14 @@ ngx_reset_pool(ngx_pool_t *pool)
}
}

- pool->large = NULL;
-
for (p = pool; p; p = p->d.next) {
p->d.last = (u_char *) p + sizeof(ngx_pool_t);
+ p->d.failed = 0;
}
+
+ pool->current = pool;
+ pool->chain = NULL;
+ pool->large = NULL;
}



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

[nginx] Core: improved ngx_reset_pool() (ticket #490).

Maxim Dounin 705 January 17, 2014 10:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

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