<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">The timer module is basically a <i>gen_server</i> that is using timeouts to invoke a timer and an <i>ordered_set </i>ETS to store the timers<div>The ordered_set is probably the cause of the memory issues you are referring to, and the gen_server/timeout implementation is, well, not exactly the most scalable way to do this...</div><div><br></div><div>Cheers<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><span class="Apple-style-span" style="-webkit-text-decorations-in-effect: underline; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><div style="font-family: Helvetica; margin-top: 0in; margin-right: 0in; margin-left: 0in; margin-bottom: 0.0001pt; "><font class="Apple-style-span" color="#1f497d" face="Calibri, sans-serif"><span class="Apple-style-span" style="font-size: 15px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(31, 73, 125); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(1, 108, 226); "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(1, 108, 226); "><b><i><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(1, 108, 226); "><a href="http://www.gravatar.com/avatar/204a87f81a0d9764c1f3364f53e8facf.png"><b><i>Mahesh Paolini-Subramanya</i></b></a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(31, 73, 125); ">That Tall Bald Indian Guy...</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(1, 108, 226); "><span style="text-decoration: underline; "><a href="http://dieswaytoofast.blogspot.com/">Blog</a></span><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span><span style="color: rgb(31, 73, 125); ">|<span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span><a href="https://twitter.com/dieswaytoofast"><span style="text-decoration: underline; color: rgb(1, 108, 226); ">Twitter</span></a><span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span>|<span class="Apple-converted-space"> </span> <span class="Apple-converted-space"> </span><a href="https://plus.google.com/u/0/108074935470209044442/posts"><span style="text-decoration: underline; color: rgb(1, 108, 226); ">Google+</span></a></span></div></i></b></div></div></div></span></font></div></div></span></span></div></div></div></span></div></span><font class="Apple-style-span" face="Calibri" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-weight: normal; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 15px/normal Calibri; color: rgb(6, 63, 244); font-size: 15px; "><u></u></div></font></div></span></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br><div><div>On Sep 21, 2012, at 7:25 PM, Michael Truog wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 09/21/2012 03:15 PM, <a href="mailto:freza@circlewave.net">freza@circlewave.net</a> wrote:<br><blockquote type="cite"><blockquote type="cite">3. Is spawning a lot of send_after's or timers a dangerous idea? In case of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">using timer module, we'll just lose some started timers due to port<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">restart. But something tells me that crash of erlang internal timers is a<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">somewhat more dangerous thing that might even crash the VM.<br></blockquote></blockquote><blockquote type="cite">Not sure I understand you here.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">These timers are a facility built directly into ERTS. If there were a<br></blockquote><blockquote type="cite">bug somewhere in the implementation, that could be as horribly nasty<br></blockquote><blockquote type="cite">as any other bug in ERTS. Other than that, they are dead pieces of<br></blockquote><blockquote type="cite">data interpreted in some conventional way by a bunch of C code, so<br></blockquote><blockquote type="cite">as such they can't really "crash" in any obvious meaning of the<br></blockquote><blockquote type="cite">word.<br></blockquote><br>I remember reading about problems using the timer module with a large number of timers because of excessive memory consumption, such that erlang:send_after/3 or erlang:start_timer/3 is generally the preferred approach.  I don't have a link to the mailing list message(s) for instances of that problem, but I assume it is still an issue today, because of extra storage used by the timer module.<br><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></div></blockquote></div><br></div></body></html>