Welcome! Log In Create A New Profile

Advanced

Re: Resident memory not released

July 30, 2019 10:46AM
Maxim Dounin Wrote:
-------------------------------------------------------
>
> Whether or not allocated (and then freed) memory will be returned
> to the OS depends mostly on your system allocator and its
> settings.

That is very interesting! I had no idea, thanks!


Maxim Dounin Wrote:
-------------------------------------------------------
> On Linux with standard glibc allocator, consider tuning
> MALLOC_MMAP_THRESHOLD_ and MALLOC_TRIM_THRESHOLD_ environment
> variables, as documented here:
>
> http://man7.org/linux/man-pages/man3/mallopt.3.html

I've been playing around with MALLOC_MMAP_THRESHOLD_ and MALLOC_TRIM_THRESHOLD_ without much success. I noticed that when setting a low value on MALLOC_TRIM_THRESHOLD_, nginx would allocate more memory, and then when disconnecting release about half of that. So a bit of progress I guess.

I then tried setting MALLOC_CHECK=1, and that magically solved it, it seems. When disconnecting the websockets, all memory was reclaimed by the OS. But I don't understand why, from reading the man pages you linked, I thought it would only trigger some logging of memory related errors.

I haven't gotten it to work with the kubernetes nginx ingress yet, it seems the environment variables isn't passed to the nginx processes for some reason. But I'm working on that.

Thanks for your help!
If anyone knows more about MALLOC_CHECK and if it is not recommended to set in a production environment, please let me know.

--
Fredrik Enestad
Subject Author Posted

Resident memory not released

fredr July 29, 2019 11:25AM

Re: Resident memory not released

Maxim Dounin July 29, 2019 01:04PM

Re: Resident memory not released

aledbf July 29, 2019 02:52PM

Re: Resident memory not released

Maxim Dounin July 29, 2019 03:12PM

Re: Resident memory not released

fredr July 30, 2019 10:46AM

Re: Resident memory not released

Peter Booth via nginx August 02, 2019 01:58AM

Re: Resident memory not released

fredr August 05, 2019 07:12AM

Re: Resident memory not released

aledbf August 05, 2019 12:37PM

Re: Resident memory not released

fredr August 06, 2019 03:52AM

Re: Resident memory not released

aledbf August 06, 2019 01:08PM

RE: Resident memory not released

R, Rajkumar (Raj) August 05, 2019 08:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 67
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready