[erlang-questions] garbage collection

Dror Mein <>
Wed Mar 18 20:38:14 CET 2015


So it comes a time that one needs to stop avoiding this issue. I have a process which receives lots and lots of binaries. He is the main culprit when checking his memory (goes up to 7GBytes and more). The eheap memory is 99% allocated to him. It is a registered gen_server. Started toying with recon and this process has too many refc binaries, and he is the recon:bin_leak winner.
Obviously, this is bad architecture. 
But since I'm looking for a quick fix, I cannot change the sending process.

So my plan is to reduce my gen_server to one that only receives a message, and immediately bangs it to a process group to handle all data processing. 
Now the question of garbage collection:Does a gen_server garbage collect when he returns from a call/cast/handle_info? Is it better to order him to erlang:garbage_collect after each call/cast/handle_info?Do I do it periodically? Can a process be so busy it never garbage_collects on his own?Should I kill the pg servers periodically to achieve some sort of forced garbage_collection?


PS: Is there any process group module that allows you to send a message to the name of the process group and a random member handles the message? because that sounds very useful
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150318/75e9368c/attachment.html>


More information about the erlang-questions mailing list