Welcome! Log In Create A New Profile

Advanced

memory pool allocation

April 09, 2014 08:31AM
Suppose, I am allocating a pool of greater than 4k(page size). Say for example I am calling the function ngx_create_pool with 8096.
But, this function will set the max as 4095 even if it has allocated 8K. Not sure, why is it being done like this.


p->max = (size < NGX_MAX_ALLOC_FROM_POOL) ? size : NGX_MAX_ALLOC_FROM_POOL;


I know, I have created a pool with size 8K, now I am allocating say 4K (4096) from this pool. I will call ngx_palloc with 4096. There we check if (size <= pool->max) which in this case will not satisfy and it will go and call ngx_palloc_large which inturn will allocate 4K.

This somehow is not sounding good. Why is ngx_create_pool putting a max value of page size even when it is allocating more. It is not doing chaining also.

Any expert opinions???

Thanks, Santos
Subject Author Posted

memory pool allocation

nginxsantos April 09, 2014 08:31AM

Re: memory pool allocation

nginxsantos April 10, 2014 02:45AM

Re: memory pool allocation

Ruslan Ermilov April 10, 2014 03:26AM

Re: memory pool allocation

nginxsantos April 10, 2014 04:32AM

Re: memory pool allocation

Valentin V. Bartenev April 10, 2014 04:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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