# NGINX reload memory leak

**URL:** <https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225>\
**Category:** NGINX\
**Created:** [March 8, 2016, 2:01pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225 "2016-03-08T14:01:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [March 8, 2016, 2:01pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225/1 "2016-03-08T14:01:45Z")

</div>

Hi,  
I am working on a module for NGINX and am having a problem with memory  
leaking when using “./nginx -s reload”. Everything that is allocated is  
done  
so through ngx\_palloc or ngx\_pcalloc so NGINX should know to clean it  
up. I  
have also added a function to exit process which uses ngx\_pfree on  
everything and then destroys the pool I created with ngx\_destroy pool,  
so  
there should be nothing left. Even so, each reload increases the memory  
slightly till NGINX crashes.  
Any ideas on why this is happening?

Thanks,  
Ben.

Posted at Nginx Forum:

> **[NGINX reload memory leak](https://forum.nginx.org/read.php?2,265157,265157#msg-265157)**
>
> Hi, I am working on a module for NGINX and am having a problem with memory leaking when using "./nginx -s reload". Everything that is allocated is done so through ngx\_palloc or ngx\_pcalloc so NGINX should know to clean it up. I have also...

---

<div class="post-metadata">

**Author:** ![ben5192](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@ben5192](https://www.ruby-forum.com/u/ben5192)\
**Post date:** [March 8, 2016, 5:19pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225/2 "2016-03-08T17:19:47Z")

</div>

Hi.

Am 08-03-2016 14:01, schrieb ben5192:

> slightly till NGINX crashes.  
> Any ideas on why this is happening?

Please can you post:

.) nginx -V  
.) the config  
.) lsb\_release -a or something similar for your system  
.) HW/VM/Image setup

---

<div class="post-metadata">

**Author:** ![ben5192](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@ben5192](https://www.ruby-forum.com/u/ben5192)\
**Post date:** [March 8, 2016, 5:46pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225/3 "2016-03-08T17:46:04Z")

</div>

This may be more appropriate for the nginx-devel list. Additionally,  
when you post there you’ll probably want to include your modules source  
so people can actually assist in debugging.

---

<div class="post-metadata">

**Author:** ![ben5192](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@ben5192](https://www.ruby-forum.com/u/ben5192)\
**Post date:** [March 8, 2016, 6:04pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225/4 "2016-03-08T18:04:46Z")

</div>

Ok, thanks. I will post this over there.

Posted at Nginx Forum:

> **[Re: NGINX reload memory leak](https://forum.nginx.org/read.php?2,265157,265161#msg-265161)**
>
> Hi, I am working on a module for NGINX and am having a problem with memory leaking when using "./nginx -s reload". Everything that is allocated is done so through ngx\_palloc or ngx\_pcalloc so NGINX should know to clean it up. I have also...

---

<div class="post-metadata">

**Author:** ![ben5192](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e8c25b/32.png) [@ben5192](https://www.ruby-forum.com/u/ben5192)\
**Post date:** [March 8, 2016, 6:04pm UTC](https://www.ruby-forum.com/t/nginx-reload-memory-leak/244225/5 "2016-03-08T18:04:11Z")

</div>

Yeah, here’s the outputs:

nginx -V  
nginx version: nginx/1.9.9  
configure arguments: --prefix=/path/to/my/module --with-debug  
–with-ld-opt=-lm

config (with some names changed):  
events {  
worker\_connections 1046;  
}

http {  
my\_set\_int 10000;  
my\_set\_string /path/to/a/data/file;  
my\_set\_another\_int 20;

server {  
listen 8888;

```
location / {
  my_location_function string;
  proxy_pass http://localhost/;
}

```

}  
}

lsb\_release -a  
No LSB modules are available.  
Distributor ID: Ubuntu  
Description: Ubuntu 14.04.3 LTS  
Release: 14.04  
Codename: trusty

This is running in a Hyper-V virtual machine with an i7 processor.

Thanks

## Aleksandar L. Wrote:

> it  
> Please can you post:
> 
> > Posted at Nginx Forum:  
> > [mailman.nginx.org archive](https://mailman.nginx.org/mailman/listinfo/nginx)  
> > Posted at Nginx Forum:  
> > [https://forum.nginx.org/read.php?2,265157,265160#msg-265160](https://forum.nginx.org/read.php?2,265157,265160#msg-265160)
