Hello!

On Mon, Nov 17, 2014 at 09:35:18AM -0500, kay wrote:

> Thanks.
> 
> Is it necessary to use ngx_pfree(str) at the end of my function?

As long as you allocate memory from a pool, it's not required to 
free the memory explicitly via ngx_pfree().  Memory will be 
freed automatically on the pool destruction.  Moreover, in most 
cases ngx_pfree() will not be able to do anything as it can only 
free large blocks of memory.

The ngx_pfree() function is only useable in some special cases 
when you have to free large blocks of memory before the pool will 
be destroyed.  For example, nginx uses ngx_pfree() to free 
connection's buffer memory for idle keepalive connections, see 
ngx_http_set_keepalive().

-- 
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to