Re: Monitor Process Memory
Mikael Pettersson <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CAM43=SOYP=xWi=DM-LRF=3BTxJdoAFG0cHyz-X_YkkpKUVjkEw@mail.gmail.com> |
On Thu, Sep 30, 2021 at 1:04 PM Vance Shipley <[email protected]> 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.