[erlang-questions] How can I release beam memory?

Jack Tang himars@REDACTED
Fri Jan 13 10:05:10 CET 2017


Hello list,

I run one Erlang application on Debian server and today I find the beam
process consumes around 35G memory by `top` command.

```
KiB Mem:  99194912 total, 61682656 used, 37512252 free,   397380 buffers
KiB Swap:        0 total,        0 used,        0 free. 18684864 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
11858 usr1   20   0 36.850g 0.032t   6220 S  73.5 34.4   8038:49 beam.smp
```

I connect to the Erlang application using remote shell and find the
mem-leaked supervisor tree and run gc on the whole tree. Code looks like
blow:

```
lists:foreach(fun(E) -> PId = element(2, E), erlang:garbage_collect(PId)
end, supervisor:which_children(some_thing_sup)).
```

and erlang:memory() decreases from 32G to 23G.
```
[{total,22982011544},
 {processes,12884182336},
 {processes_used,12884170336},
 {system,10097829208},
 {atom,13828705},
 {atom_used,13796692},
 {binary,170530288},
 {code,16450626},
 {ets,9637717576}]
```

However, when I input `top` command, the beam process still takes 35G
memory. What can I do to release the 9G memory? Thanks

BR
-- 
Jack Tang


http://www.linkedin.com/in/jacktang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170113/e6f68571/attachment.htm>


More information about the erlang-questions mailing list