Welcome! Log In Create A New Profile

Advanced

Re: How do i free memory when my master process ends?

Maxim Dounin
June 02, 2014 11:58AM
Hello!

On Mon, Jun 02, 2014 at 04:15:09PM +0530, Adarsh Pugalia 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 Dounin
http://nginx.org/

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

How do i free memory when my master process ends?

Adarsh Pugalia June 02, 2014 06:46AM

Re: How do i free memory when my master process ends?

Maxim Dounin June 02, 2014 11:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 135
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready