Reputation: 9289
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 better way that I missed while searching?
Upvotes: 1
Views: 406
Reputation: 7402
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.
Upvotes: 2