[erlang-questions] Port handlers and binary leaks?

Vans S vans_163@REDACTED
Mon Oct 17 15:17:50 CEST 2016

Holding a ref to a binary greater then 52 bytes keeps it from getting cleaned, under 52 bytes it gets copied.

To hold a ref you need to add that binary/iolist-member to a map/list or ets table.

If all your tcp process is doing is forwarding iolist/binary to another process for processing.  That should not cause any issues.


    On Monday, October 17, 2016 7:26 AM, Oliver Korpilla <Oliver.Korpilla@REDACTED> wrote:


Recent reading got me concerned about leaking memory by having big refc binaries.

In our system we have permanent TCP and SCTP handlers that receive outside messages, then forward it into the system for processing.

For example, these events have ASN.1 payloads. Decoding is done in throw-away processes... however, I'm concerned that the TCP and SCTP handling processes might cause memory leaks because every payload buffer is handled there first.

I saw in "Erlang in Anger" that routers should only return where to route to, not handle the message. But when handling sockets I don't see that option?

What is good practice here? Am "I" at risk?

Thanks and best regards,
erlang-questions mailing list

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

More information about the erlang-questions mailing list