[erlang-questions] System limit for erlang process and Pid

Mikael Pettersson mikpelinux@REDACTED
Sun Oct 16 19:09:39 CEST 2016

ARUN P writes:
 > Hi,
 >      Am a newbie in erlang programming world and I seriously need some 
 > assistance. I am running an application in which am using 
 > *timer:apply_interval(1000, ?MODULE, monitor_loop , [])*, as per my 
 > analysis found that this function call creates new processes at every 
 > 1000 millisecond interval. Since my *monitor loop* function only takes 
 > around 800 ms to complete its duty and then it dies,  the number of 
 > processes are not getting increased. But as per my observation every 
 > time am getting a new PID and the PID number is always increasing and I 
 > came to know that the pid is limited by, 1 word for a process identifier 
 > from the current local node + 5 words for a process identifier from 
 > another node.
 >      So what will happen if my application continuous to run for months 
 > without stopping, will it crash the entire erlang vm.

No.  The VM is quite capable of running for _years_.

I assume the local pids will wrap around and unused ones be reused, but
I haven't checked this.

 > How the garbage 
 > collection will be happening for the dead process since for every 
 > process some amount of heap memory is getting allocated.

The memory allocated to an Erlang process, including its heap and stack,
is deallocated (not GC:d, more like free()) when that process terminates.

More information about the erlang-questions mailing list