[erlang-questions] Memory allocation HOWTO from Fred

Max Lapshin <>
Fri Nov 8 21:33:44 CET 2013


Fred, I haven't found yet any good solution, because I've just read your
article.

My problem is that I write software that should be used in at least 20
different use cases with different profiles of usage and I have absolutely
no control over protocols that are used =)


Most horrible situations are something like accepting 1500 byte packets via
UDP multicast. Erlang without special C driver cannot handle this load and
I need to write special driver in C to accumulate packets.

Also there are many problems with situations when I cannot use iolists
because one protocol needs to be converted to other and it involves very
complicated bit parsing with saving intermediate state.


It is definitely clear that on my usecases appending binaries works better
than iolists and especially than iolist + reverse.
I suppose it happens because small binaries are collected faster and gets
out of young generation, but it is only a suppose.

I've even written small code in .S to preallocate binary when I can guess
size: https://gist.github.com/maxlapshin/5531424
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131109/f14a909e/attachment.html>


More information about the erlang-questions mailing list