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's why there'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've noticed a typo (though it helped me understand the code, which I couldn't get completely at first), indeed the 'showResult' function misses a 'q' argument.<br /><br />Second, debugging this, it appeared to me that although you claimed there's no recursion involved there seems to be some anyway.<br />In the 'next' function of Queue, we can find '!!callback(q)', and to fire the next function, 'q.next()' 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