[erlang-questions] Preventing memory crashes

Roger Lipscombe roger@REDACTED
Mon Nov 21 19:36:46 CET 2016


It sounds like the existing high memory alarm would be enough...?

See http://erlang.org/doc/man/memsup.html

On 21 November 2016 at 18:29, Lyn Headley <lheadley@REDACTED> wrote:
> Erlangers,
>
> I am looking to write a process that makes sure my node does not run
> out of memory and crash. What I would like is a function F that
> returns a number that represents the amount of memory my node is
> using. If that number gets above a threshold T, I will kill a process
> (carefully and safely, possibly after dumping its ets table to disk).
> After the process exits, I would immediately call the same function F
> and see whether the number it returns is now less than my threshold T.
> If not, kill another process, etc.
>
> Can I easily write this function F? Does the 'total' number from
> erlang:memory serve my needs here? In particular, will it go down
> immediately after I kill a process?
>
> Given a carefully chosen value for threshold T, and assuming no atoms
> or binaries are being allocated, (heap data and ets tables are the
> main drivers of memory use), will this strategy indeed prevent my node
> from crashing as long as I kill processes faster than they can grow?
>
> Other thoughts?
>
> -Lyn
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list