Hi!<div><br></div><div>@Wang</div><div><br></div><div>It is not ok to let a gen_server delete itself because it is not guaranteed to delete the reference associated with it from the shared table. This approach will leak memory unless the child processes don't exit under ideal conditions.</div>
<div><br></div><div>@Zvi</div><div><br></div><div>when you both link and monitor the child process you are doubling the amount of work your server needs to keep up with, since you are already linked you can skip monitoring.</div>
<div><br></div><div>There is also one possible issue with your server which is that you are starting the child processes directly from the same server receiving the EXIT and DOWN messages. In the process info you included you can see that the current function is proc_lib:sync_wait, this call happens to be inefficient on processes with large inboxes, it'll likely turn out to be much more of a bottleneck than the ETS calls in delete_by_pid.</div>
<div><br></div><div>MVH Magnus</div><div><br><div class="gmail_quote">On Fri, Nov 4, 2011 at 3:36 AM, Wang Wei <span dir="ltr"><<a href="mailto:wgwi@sxu.edu.cn">wgwi@sxu.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi, Is it ok to let spawned gen_servers delete themselves in ETS table when they terminated? If you spawn and destroy too fast that will a lock condition in the main gen_server.<br>
<br></blockquote></div></div>