开发者

Measuring OS process (port) memory usage in Erlang

开发者 https://www.devze.com 2023-03-30 22:54 出处:网络
I have an Erlang system that runs user specified programs on many machines. It uses Erlang ports to run those programs.

I have an Erlang system that runs user specified programs on many machines. It uses Erlang ports to run those programs. Sometimes programs have memory leaks and they can freeze entire machine that they were spawned on.

How can I measure, how much memory erlang port is using?

Unfortunately, erlang:memory/0 does not include port memory. Should I use os:cmd/1 invoking ps inside and then parse its output? Or is there a be开发者_C百科tter way that I missed while searching?


I can understand that you'd want to handle this from within your application. But maybe a problem like that would better be handled through setting ulimit or setrlimit (assuming you're running on a *nix-machine)?

If your OS has a /proc-filesystem, you could look for info on your processes there.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号