[erlang-questions] Memory issue: big swap usage
Erik Søe Sørensen
Mon Jul 16 10:33:56 CEST 2012
Either the problem is in Erlang code, or it's a leak at a lower level. The
erlang:memory() numbers seem to indicate the latter.
If it's a low-level issue, then a leak detector like libumem(?) or Valgrind
might be of some use.
It may be an idea to check if the number of ports is stable, and whether it
helps matters if you do the work in a short-lived process. Other than that,
I guess the issue may be hard to tackle from within Erlang itself.
Den 16/07/2012 10.02 skrev "龙第九子" <>:
> Hi all,
> Recently I wrote a service-monitoring program in Erlang. It uses httpc
> (the HTTP client shipped with Erlang/OTP) to fetch web server
> statistics data, does some calculations, and then sends results to
> another service. It works fine, however, the memory usage is very
> strange. While VmRSS stays at a reasonable level, but VmSize and
> VmData keep increasing (about 40m per day). Please look at the
> following data:
> System memory usage:
> $ free -m
> total used free shared buffers
> Mem: 2012 1486 525 0 216
> -/+ buffers/cache: 557 1455
> Swap: 2047 5 2041
> `top` shows that the beam.smp process consumes 51m physical memory :)
> and 857m swap memory :(
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP
> 27100 root 20 0 909m 51m 2288 S 2 2.6 149:54.65 857m
> Current VM status of the process:
> $ cat /proc/27100/status|grep Vm
> VmPeak: 932260 kB
> VmSize: 931616 kB
> VmLck: 0 kB
> VmHWM: 54624 kB
> VmRSS: 52968 kB
> VmData: 907556 kB
> VmStk: 88 kB
> VmExe: 1860 kB
> VmLib: 2412 kB
> VmPTE: 208 kB
> And Erlang reported memory usage (seems good):
> 15> erlang:memory().
> I use Erlang R14B03 (erts-5.8.4) compiled with GCC 4.4.5 on Debian 6
> Linux 2.6.32-5-amd64. I'm not sure if there is a memory-leaking bug.
> The problem is too hard for me and I have no choice but to restart the
> process. Could someone be kind enough to help me out? Please.
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions