I cant figure out why memory gets full after every couple of days. I have to free it using “echo 1 > /proc/sys/vm/drop_caches” command. Might be memory leak but I cant find the source.
I am using Ubuntu 14.04.4
The Linux disk cache is very unobtrusive. It uses spare memory to greatly increase disk access speeds, and without taking any memory away from applications.
It is a bad practice to drop the cache Unless you’re trying to address a performance issue, there’s no need to prevent any cache use. When you drop the cache (or caches), you will see the CPU load go up (sometimes way up) because the cache is gone. Available RAM goes up, but it does not matter because performance is slower because the cache is empty.
Then over time, if you leave the caches off, the performance will suffer because you are not taking advantage of the cache.
Linux tries to use all available RAM, so the caches will fill over time if you don’t instruct Linux to drop the caches, and this is a good thing. You will see available RAM go down, but don’t worry, it is available for applications when needed because applications take higher priority than cache
If Asterisk is not involved on this issue ,next questions must be addressed outside this forum,
This is an OS problem, not an Asterisk one. You have about 7GB of effectively free memory and the OS should be performing on that basis.
Note, if Asterisk is suffering from memory starvation, there should be warnings/errors when the relevant system call fails, not just lhe secondary/tertiary symptom you are reporting here.
The fact that your swap usage is zero is confirmation that you do not have memory starvation.
One thing. Is this a virtual machine. If so reduce the allocated memory to 1 or 1.5GB and make sure there is that much physical memory on the host to fully back it up.
Well I’m new to Asterisk and Linux, so wasn’t sure if Asterisk was eating the memory. And secondly 7GB was not free, that was used memory, only 262MB was free (columns weren’t aligned).
Thirdly its a physical machine. Nyway Thanx for the support, I’ll post the issue on Ubuntu forms.
7046 MB are effectively free. The purpose of the +/- line is to show the true amount of free and used memory that cannot be thrown away at a moment’s notice.
Incidentally, Windows NT family systems (all modern Windows) use the same trick and also runs with nearly all memory allocated on systems that are not totally over-provisioned.
Linux and Windows deliberately run with very little completely unused RAM, so you should always expect them to use nearly all of however much RAM you give them.
Can you please confirm that you are running this directly on real hardware.
I encounter the same problem. it does not seem solved. I created 4 VM with Hyper V (4 centos 7 / kernel 5.0.10 / Asterisk 13.26.0 patched)
The servers has no trafic for the moment (not in production) but the memory goes from 500MB to 5GB after a couple of days only. Without any activity on asterisk !
The solutions to Asterisk 1.8 are Asterisks 13 and 17!
By 1.8, do you mean 1.8.32.2? If not you need to upgrade to at least that even to fix all bugs that were fixed in 1.8.
Otherwise, you need to work out what in your use of Asterisk causes the memory leak, and stop doing that. The amount leaked per call may be a clue.
The only partially valid reason for having 1.8 is that this is an old system, in which case it seems likely that there were no memory leaks in the almost six years since it went into security fix only status, so what recently changed and started producing leaks?
haha! I already know that later versions fix problems. But this version is part of a project and it is not so easy to update to the latest version.
The version is 1.8.28 runs in conjunction with MySQL.
The error occurs after a time without restarting and after many calls. It seems that it was occupying memory but it does not free it. You understand me ?
Yes, it is an old system, but this occurred in a client with a lot of call traffic. Perhaps the system was overwhelmed.
People are not going to remember what memory leak bugs exist in an 8 year old (almost) version of Asterisk.
If you can’t upgrade, you are going to have to work out what is unusual about the system, then start removing that until the leak stop.
The only other option would be to look through the change logs since November 2012, to see if you recognize one that fixes a memory leak that might apply in your case.