Live data from Hacker News

Erlang is a hoarder

andy.wordpress.com

11–13 of 13 posts

Re: Erlang is a hoarder

#11
post #5

Uhh, I've seen this too. Part of the reason we are migrating some code from Erlang to C.

It could be argued that this is a poor reason to switch from Erlang to C -- this is a problem with how binaries are handled in user code, not something intrinsic to Erlang VM.

Eh, every factor involved is implementation detail. The threshold at which binaries are heap-alloc'ed, gc behavior, etc. I really fail to see how this is user error.

Re: Erlang is a hoarder

#12
post #5

Earlier quoted context omitted.

It could be argued that this is a poor reason to switch from Erlang to C -- this is a problem with how binaries are handled in user code, not something intrinsic to Erlang VM.

Eh, every factor involved is implementation detail. The threshold at which binaries are heap-alloc'ed, gc behavior, etc. I really fail to see how this is user error.

I really fail to see how this is user error.

That isn't what the parent comment said.

Re: Erlang is a hoarder

#13
post #8

I think two things are interesting here. 1: "when does Erlang GC a process' heap?" and 2: "where does Erlang keep a process' data?". 1: Erlang GCs a process' heap whenever that process' heap gets full, or when you call erlang:garbage_collect() explicitly. 2: Erlang stores most data associated with a process on the process heap, there's one such heap per erlang process. Binaries are a special case. If they're large (>…

Might this be considered a symptom of an architecture problem? I'm far from an Erlang expert but my understanding is that processes generally should be short lived, except for supervisors, which should only supervise. Instead of having a single long-lived process handling a lot of large binaries would a better design be to have separate processes handling each binary?

In my case the processes needing gc are streaming TCP sockets. Their module is just a loop function which receives a binary and sends it to the client then does a tail call. So there should be no reason for the process to die. They have been running indefinitely except when the system ran into swap.
Post reply on HN