Valentin V. Bartenev
April 09, 2014 06:26AM
On Wednesday 09 April 2014 04:55:42 nginxsantos wrote:
> Nginx when it accepts a connection, it creates a memory pool for that
> connection (allocating from heap). After which further memory requirement
> for that connection will be allocated from that pool. This is good.
> But, why don't we pre create the memory pools depending upon the number of
> connections and use that pool. In the current approach if some connections
> are coming up going down., we will be allocating and freeing to heap
> frequently.
>
> Can someone please clarify why this has been done like this?
>

System allocators are usually smart enough to not transform every malloc()
into syscall.

One of the main benefits provided by these pools is convenient memory
management for C program that allows to not care much about corresponding
free() calls and memory leaks.

So usually every pool is attached to some object with a clear life cycle,
like a request or a connection.

wbr, Valentin V. Bartenev

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

Memory Pool

nginxsantos April 09, 2014 04:55AM

Re: Memory Pool

nginxsantos April 09, 2014 05:45AM

Re: Memory Pool

Valentin V. Bartenev April 09, 2014 06:26AM

Re: Memory Pool

nginxsantos April 09, 2014 08:22AM

Re: Memory Pool

Valentin V. Bartenev April 09, 2014 10:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready