Reputation: 387
According to the result of "top" command, the memory usage experienced increasing a lot. However, the according to the memory usage of each processes, there are not so much memory used.
top - 19:57:01 up 1 day, 19:24, 6 users, load average: 0.17, 0.22, 0.57
Tasks: 500 total, 1 running, 499 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.1%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 98858004k total, 90524192k used, 8333812k free, 1039700k buffers
Swap: 16777208k total, 0k used, 16777208k free, 72896460k cached
It seems that the Linux will mark buffers/cache memory usage as used, but they are not used by applications. In this case, I still have a log memory available.
However, the memory and swap was then exhausted, which causes the failure of the server. Is it possible that this is a memory leak of some applications?
If encountering a memory leak, will the memory usage be calculated into the process?
free -m
total used free shared buffers cached
Mem: 96541 88445 8095 0 1016 71223
-/+ buffers/cache: 16205 80335
Swap: 16383 0 16383
Upvotes: 0
Views: 685
Reputation: 84393
As long as the leak isn't in the kernel, any leaked memory should be accounted against the application's process.
Linux is very aggressive about caching, and tends to allocate a lot of available memory for caching filesystem blocks and storing buffers. It's very dynamic, so this space is still available to applications if they need it, but in the meantime Linux tries to put it to use.
In other words, don't assume that a high percentage of memory used is a symptom of memory leaks. It's business as usual for the kernel.
http://linux.about.com/od/lsa_guide/a/gdelsa44.htm
Upvotes: 0
Reputation: 3903
Make sure /proc/sys/vm/overcommit_memory
is 0. If it isn't it's much harder to spot runaway memory eating processes.
Upvotes: 0
Reputation: 982
If encountering a memory leak, will the memory usage be calculated into the process?
Yes, a memory leak is just data who isnt needed anymore but hasnt gotten freed free(trash);
However, the memory and swap was then exhausted, which causes the failure of the server. Is it possible that this is a memory leak of some applications?
Yes, monitor wich program uses somuch RAM and debug it with http://valgrind.org/
Upvotes: 1