Forum: NGINX Life of objects allocated using the request pool?

1ba75714933d7ed0670abfb47a49d7ef?d=identicon&s=25 Adarsh Pugalia (Guest)
on 2014-06-11 08:56
(Received via mailing list)
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?
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-06-12 00:07
(Received via mailing list)
Hello!

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
http://nginx.org/
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.