tag:blogger.com,1999:blog-34454975.post2351585058609453109..comments2023-06-28T16:58:41.189+02:00Comments on Web Reflection: Working With QueuesAndrea Giammarchihttp://www.blogger.com/profile/16277820774810688474noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-34454975.post-65221944195549073632012-08-21T23:38:31.316+02:002012-08-21T23:38:31.316+02:00can you give me an example of callstack blowup? .....can you give me an example of callstack blowup? ... if you q.next() sync I think it should be sync, that&#39;s why there&#39;s no setTimeout in q.next() logicAndrea Giammarchihttps://www.blogger.com/profile/16277820774810688474noreply@blogger.comtag:blogger.com,1999:blog-34454975.post-33905035186243524412012-06-20T15:05:11.832+02:002012-06-20T15:05:11.832+02:00Hello Andrea, Two comments. First, after playing...Hello Andrea,<br /><br />Two comments.<br /><br />First, after playing around with your example, I&#39;ve noticed a typo (though it helped me understand the code, which I couldn&#39;t get completely at first), indeed the &#39;showResult&#39; function misses a &#39;q&#39; argument.<br /><br />Second, debugging this, it appeared to me that although you claimed there&#39;s no recursion involved there seems to be some anyway.<br />In the &#39;next&#39; function of Queue, we can find &#39;!!callback(q)&#39;, and to fire the next function, &#39;q.next()&#39; is used.<br />My suggestion would be to setTimeout 0ms the callback function, if any, to avoid a callstack blowup.<br /><br />What do you think of that?Adrien Risserhttps://www.blogger.com/profile/16323702454473306102noreply@blogger.com