How do i free memory when my master process ends?

I am allocating memory using malloc for some of my variables in my
module.
I know i can call an exit master process, but how do i access my
variables
in that function. I tried finding some examples, but didnt find any. Can
anyone guide me through this.

Hello!

On Mon, Jun 02, 2014 at 04:15:09PM +0530, Adarsh P. wrote:

I am allocating memory using malloc for some of my variables in my module.
I know i can call an exit master process, but how do i access my variables
in that function. I tried finding some examples, but didnt find any. Can
anyone guide me through this.

Resource allocation and deallocations are usually done with pools
in nginx. If you want to do some allocations which aren’t from
pool (e.g., an opened file, or a memory allocated directly with
malloc() for some reason), it’s usually good idea to add a pool
cleanup to do required deallocation when coresponding pool will be
destroyed.

Try looking into the code for ngx_pool_cleanup_add(), there are
lots of examples.


Maxim D.
http://nginx.org/