Monitor Process Memory

Wojtek Surowka wojteksurowka@REDACTED
Thu Sep 30 13:09:02 CEST 2021

You could use process_info(self(), memory) to get the amount of memory used by your process, and react accordingly.


From: erlang-questions <erlang-questions-bounces@REDACTED> On Behalf Of Vance Shipley
Sent: 30 September 2021 12:04
To: Questions erlang-questions <erlang-questions@REDACTED>
Subject: Monitor Process Memory

I have a function in user_default which I would like to protect
against naive users consuming all the memory.  It runs a loop building
an accumulator which is a list of records.

I could just use a guard of length(Acc) < ?MAXLEN however I don't
really know how big the records are. I'd like to stop when too much
memory is being used by Acc, or maybe the (shell) process.

Any suggestions?


More information about the erlang-questions mailing list