<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">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.</div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr"><br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">Obviously, this is bad architecture. <br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">But since I'm looking for a quick fix, I cannot change the sending process.<br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr"><br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">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. </div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr"><br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">Now the question of garbage collection:</div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">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?</div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">Do I do it periodically? Can a process be so busy it never garbage_collects on his own?</div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr">Should I kill the pg servers periodically to achieve some sort of forced garbage_collection?<br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr" class="" style=""><br class="" style=""></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr" class="" style=""><br></div><div id="yui_3_16_0_1_1426702433525_2703" dir="ltr" class="" style="">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</div></div></body></html>