[erlang-questions] Investigate an infinite loop on production servers

Matthias Lang matthias@REDACTED
Tue May 28 00:50:26 CEST 2013


> On May 24, 2013, at 11:13 AM, Morgan Segalis <msegalis@REDACTED> wrote:

> > Is there a way to limit the memory that a VM can allocate, so the
> > server is not overwhelmed in order to create a crash dump ?

Sorry for the late input, I haven't been following this thread.

Here's how we limit Erlang's memory use (on linux):

   static void set_limit_for_memory_consumption()
   {
     struct rlimit rlim;

     if(getrlimit(RLIMIT_AS, &rlim))
       {
         die("getrlimit failed");
       }
     else
       {
         rlim.rlim_cur = MAX_MEM;
         if(setrlimit(RLIMIT_AS, &rlim))
   	{
   	  die("setrlimit failed");
   	}
         syslog(LOG_INFO, "Limiting Erlang memory use to %u\n", MAX_MEM);
       }
   }

works well for us.

Matt



More information about the erlang-questions mailing list