Life of objects allocated using the request pool?

Maxim Dounin mdounin at
Wed Jun 11 22:07:12 UTC 2014


On Wed, Jun 11, 2014 at 12:26:03PM +0530, Adarsh Pugalia wrote:

> What is the life of objects allocated using the request pool? If I allocate
> memory from the r->pool in a request handler, what would be the life of the
> object? Will the objects be freed if the request is over of will it sustain
> over multiple requests?

The request pool is destroyed with the request, and no objects 
allocated from the pool can be used after this.

That's actually the whole point: allocations from a pool don't need 
to be freed individually, it's enough to destroy the pool itself.

Maxim Dounin

More information about the nginx mailing list