Monitor Process Memory

Mikael Pettersson mikpelinux@REDACTED
Thu Sep 30 15:01:11 CEST 2021

On Thu, Sep 30, 2021 at 1:04 PM Vance Shipley <vances@REDACTED> wrote:
> 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

Others have already given alternative solutions. I would just like to
warn that the suggestion above if implemented literally would cause
overheads quadratic on the length of Acc. You can avoid that by
maintaining the length yourself.

More information about the erlang-questions mailing list