Possible memory leak?

Maxim Dounin mdounin at mdounin.ru
Thu Mar 21 13:45:26 UTC 2019


Hello!

On Wed, Mar 20, 2019 at 06:41:01PM -0400, wkbrad wrote:

[...]

> The first test I ran was in FreeBSD just because I was curious.  Lol.  But I
> actually saw the exact same problem on it.  I can send you some tests if you
> like but they look the same as the others do.

On FreeBSD you'll see that _virtual_ memory usage grows on reload, 
but the actual memory is returned to the system and can be used by 
other processes.  

[...]

> Notice it starts up using more memory than before but it now does not double
> it's ram usage after a reload.  I can deal with that but I'm still curious
> if you know why it's now using more ram.  Any thoughts on that?

This is because mmap()-based individual allocations imply additional 
overhead.  Using mmapAnd this is are costly.

> 
> But when I bring this setup to one of my live servers the effect isn't quite
> the same.  Here is a test from it with the same settings in systemd.
> --------------------------------------------------------------------------------
> [root at live ~]# systemctl restart nginx; sleep 60; ps_mem |egrep 'RAM|nginx'
>  Private  +   Shared  =  RAM used	Program 
>  21.6 MiB +   1.4 GiB =   1.5 GiB	nginx (3)
> [root at live ~]# systemctl reload nginx; sleep 60; ps_mem |egrep 'RAM|nginx'
>  Private  +   Shared  =  RAM used	Program 
>  21.9 MiB +   2.3 GiB =   2.4 GiB	nginx (3)
> --------------------------------------------------------------------------------
> 
> So that's definitely better but still not like the test environment.  I'm
> sure part of the difference is that this server has real traffic and is
> somewhat busy.  And it's using caching and probably has different buffer
> settings and such.  So that may explain why there is an increase.  But it's
> still very perplexing.
> 
> What are your thoughts on all of that?
> 
> And thank you again for all of the help!
> 
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,283216,283448#msg-283448
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list