When I run my WebSocket test, I found the following interesting memory usage results:
<div><br></div><div>1. Server stated, no connection</div><div><div>[{total,573263528},</div><div> {processes,17375688},</div><div> {processes_used,17360240},</div><div> {system,555887840},</div><div> {atom,472297},</div>

<div> {atom_used,451576},</div><div> {binary,28944},</div><div> {code,3774097},</div><div> {ets,271016}]</div><div>44 processes,</div><div><b><font class="Apple-style-span" color="#660000">System:705M, </font></b></div><div>

<b><font class="Apple-style-span" color="#660000">Erlang Residence:519M</font></b></div><div><br></div></div><div>2. 100K Connections</div><div><div>[{total,762564512},</div><div> {processes,130105104},</div><div> {processes_used,130089656},</div>

<div> {system,632459408},</div><div> {atom,476337},</div><div> {atom_used,456484},</div><div> {binary,50160},</div><div> {code,3925064},</div><div> {ets,7589160}]</div><div>100044 processes,</div></div><div><div><font class="Apple-style-span" color="#660000"><b>System: 1814M, </b></font></div>

<div><font class="Apple-style-span" color="#660000"><b>Erlang Residence: 950M</b></font></div></div><div><br></div><div>3. 200K Connections ( restart server and create from 0 connection, not continue from case 2)</div><div>

<div>[{total,952040232},</div><div> {processes,243161192},</div><div> {processes_used,243139984},</div><div> {system,708879040},</div><div> {atom,476337},</div><div> {atom_used,456484},</div><div> {binary,70856},</div><div>

 {code,3925064},</div><div> {ets,14904760}]</div><div>200044 processes,</div><div><b><font class="Apple-style-span" color="#660000">System:3383M, </font></b></div><div><b><font class="Apple-style-span" color="#660000">Erlang: 1837M</font></b></div>

<div><br></div></div><div>The figures in red are provided htop, others are output of memory() call from erlang shell. Please look at the total and erlang residence memory. When there is no connection, these two are roughly same, with 100K connections, residence memory is a little larger than total, with 200K connections, residence memory is almost double the total. </div>

<div><br></div><div>Can anybody explain?</div><div><br></div><div>Cheers</div><div>Andy</div>