RE: Monitor Process Memory

"Wojtek Surowka" <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
You could use process_info(self(), memory) to get the amount of memory used by your process, and react accordingly.

Regards,
Wojtek

From: erlang-questions <[email protected]> On Behalf Of Vance Shipley
Sent: 30 September 2021 12:04
To: Questions erlang-questions <[email protected]>
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?

-- 
     -Vance
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.