[erlang-questions] Question about TCP connection and drv_binary memory allocation

叶少波 ye02@REDACTED
Fri Dec 8 05:07:01 CET 2017

Hi erlang experts,

I did a testing about tcp connection.
The scenario is simple:
1) start two erlang nodes (let us say "node C" and "node S") with flag "+Mim true" to enable the instrument;
2) on "node S" I start a TCP server which accepts connections;
3) on "node C" I spawn 10000 processes to connect to "node S"; all the connections were successful;
4) I use instrument to lookat the "drv_binary" and "binary" memory status, I found on "node S", there was a 419461 bytes drv_binary item
   corresponded to per TCP connection; but there was NOT a same drv_binary item on "node C".   The total memory usage on "node S"
  is 419461 * 10000, about 4G, too huge.

 My question is: who allocated the 419461 drv_binary memory?

This is the tcp options on "node S" I used:

-define(TCP_OPTS, [


    {backlog, 256},

    {packet, 0},

    {active, false},

    {reuseaddr, true},

    {nodelay, false},

    {delay_send, true},

    {keepalive, true},

    {send_timeout, 60000},

    {exit_on_close, true}


This is the memory status that I use instrument:memory_data/0 and  instrument:descr/1 to lookat:
[ .......

Thanks very much.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171208/5ac83153/attachment.htm>

More information about the erlang-questions mailing list