[Proto-Scripty] Re: IE7 Timers Memory Leaks?
On Mar 3, 2:55 am, Tobie Langel tobie.lan...@gmail.com wrote: Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). And if, as you implied, that doesn't quite work because your callback is building DOM and hasn't quite finished on some browsers by the time you try to use the DOM, you should use Function.defer(), which is designed for this purpose, rather than timeouts. Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
I guess what I'm having trouble coming to grips with is that Tobie feels that buying another book solves problems and that I don't read. Ah skip that, it's late and one side of my brain has gone to sleep already. I can ignore that. The thing is that setTimeOut takes two arguments, the thing you want to execute when the timer zeros and the the timer value setTimeOut ('thing', timervalue). Now how the heck does the 'thing', return a value that causes the timer to timeout quicker? I haven't found any doucmentation that says your function ( even a function with no return value ) can cause setTimeOut to do that. What I have found is ... http://www.codingforums.com/archive/index.php/t-105253.html http://www.daniweb.com/forums/thread89100.html http://www.eggheadcafe.com/software/aspnet/31902144/bug--multiple-javascrip.aspx http://bugs.sakaiproject.org/jira/browse/SAK-13125 http://groups.google.com.au/group/Google-Maps-API/browse_thread/thread/4993c4e20f803bc3 http://forums.aspfree.com/html-javascript-and-css-help-7/settimeout-not-working-in-ie7t-261430.html and more ... I had read one or two that related to memory leaks and that's why I wondered. But OK, I'm going to go retest on FF. And relook at the way I am using setTimeout. As for those who suggested that I could somehow use onSuccess: in Ajax.Request to put off further processing until that event occurred, the answer is no, it doesn't wait. OnSuccess: function () { doFutherProcessing() } will do the futher processing before the results of the CGI script are returned. I have thoroughly test this. So Success is apparently determined before the script's return values are available. Rude to be sure. It doesn't work. So I have to use setTimeOut() to get the proper delay to continue processing. And that works. But my setTimeOut() problems currently have nothing to do with Ajax.Request() and everything to do with CSS dropdown Menus that don't always want to stay open for the delay time I set. Sorry, I didn't make that clear. BearState On Mar 2, 11:45 pm, Alex Mcauley webmas...@thecarmarketplace.com wrote: myTimeout=setTimeout(function(var,var2,var3,var4) { global x,y,z; alert('foo = bar'); },5000); whats wrong with that ? I dont think this leaks memory so why should any timeout leak memory Alex - Original Message - From: BearState wixelb...@yahoo.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, March 03, 2009 3:36 AM Subject: [Proto-Scripty] Re: IE7 Timers Memory Leaks? Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel tobie.lan...@gmail.com wrote: Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). I suggest you buy yourself a good book on Prototype[1] and maybe one on JavaScript too, while you're at it. ;) Best, Tobie [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... On Mar 3, 1:43 am, BearState wixelb...@yahoo.com wrote: Hidie-ho, Well Ok, I've used setTimeout a few times in my code to delay resuming run of a code module until Ajax.Request() has had time to do its thing. And the use of the timer is cyclic as the user may repeat the operation over and over again, but in different parts of the page. And ... holy spacetime wormhole continuum out of wack batman! Why is that timer firing off so quickly? What in the wide wide world of sports is go'n on? Robin, haven't you done a web search yet? There's people complaining about memory leaks with regard to timers? Holy abscent minded browser batman! Is it the setTimeout() function causing the problem? Damned if I know Robin, I only stomp on Penquins and Jokers, not memory leaks and I'm not int
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
And if, as you implied, that doesn't quite work because your callback is building DOM and hasn't quite finished on some browsers by the time you try to use the DOM, you should use Function.defer(), which is designed for this purpose, rather than timeouts. Colin I don't think that's the issue BearState had (I might be wrong, but he expressed similar problems in a previous thread). Furthermore, evidence of the issue you are mentioning in modern browsers is scarce. Best, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
BearState, You will need to provide actual code for people to help you out more. Currently, it's difficult to understand what your exact issue is. FWIW onSuccess and setTimeout work very well. They're both used in countless number production apps over the world. Best, Tobie --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
As for those who suggested that I could somehow use onSuccess: in Ajax.Request to put off further processing until that event occurred, the answer is no, it doesn't wait. OnSuccess: function () { doFutherProcessing() } will do the futher processing before the results of the CGI script are returned. I have thoroughly test this. So Success is apparently determined before the script's return values are available. Rude to be sure. I see three possibilities. 1. You are mistaken 2. Your code isn't doing what you think it is doing 3. You have found a genuine bug, which none of the developers of hundreds of sites (perhaps thousands) have encountered. We can't help you any further until you show us what you It doesn't work. So I have to use setTimeOut() to get the proper delay to continue processing. And that works. But my setTimeOut() problems currently have nothing to do with Ajax.Request() and everything to do with CSS dropdown Menus that don't always want to stay open for the delay time I set. It is not possible to use setTimeOut to get the proper delay, because the proper delay depends on your server and the link to it. You might get a timeout value which almost always works: but the next time you do it, it may fail. That is why setTimeOut (and its Prototype cousin function.delay()) is not the right tool here. In response to your technical question: The thing is that setTimeOut takes two arguments, the thing you want to execute when the timer zeros and the the timer value setTimeOut ('thing', timervalue). Now how the heck does the 'thing', return a value that causes the timer to timeout quicker? I haven't found any doucmentation that says your function ( even a function with no return value ) can cause setTimeOut to do that. It doesn't. It can't. The 'thing' doesn't run until the timeout completes, so it can't possibly affect the timeout. You can save the value of the timeout, and use that in other code to kill the timer: var timer = setTimeOut(myFunc, 1.2); ... if (condition) clearTimeout(timer); Colin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
My understanding is that OP is actually doing: setTimeout(myFunc(myArg), 1); Which of course executes the function immediately. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
Hi, OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? It's calling the function right away rather than after a delay. The braces are incorrect (though syntactically valid). When that line runs, the function is called immediately, and then I _think_ the result is thrown away and undefined is passed into setTimeout; either that, or the function's result is passed into setTimeout, but I'm pretty sure not. Again, you just don't do that, so I'm not sure of the effect of the braces. I am sure the function is executed immediately. You wanted to write this: xtimer = setTimeout( function(){ doSomething( arg1, arg2, arg3 ); }, 500); ^^ Or even better, use the features[1] of the library we're all talking about: xtimer = doSomething.delay(0.5, arg1, arg2, arg3); I'll second Tobie's suggestion: It's well worth your time to read up on this stuff. Websites, blogs, wikis, good old-fashioned books, etc. Here's[2] a list of suggested material in the unofficial FAQ. Also, take an hour to read through the complete Prototype API[3] (literally, that's all it takes to read through it, an hour). In a couple of months' time, you might check out Crockford's site[4] on JavaScript (not Prototype), but probably not right now -- he gets into advanced topics. [1] http://prototypejs.org/api/function/delay [2] http://proto-scripty.wikidot.com/faq#learn [3] http://prototypejs.org/api [4] http://javascript.crockford.com HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 3, 3:36 am, BearState wixelb...@yahoo.com wrote: Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel tobie.lan...@gmail.com wrote: Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). I suggest you buy yourself a good book on Prototype[1] and maybe one on JavaScript too, while you're at it. ;) Best, Tobie [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... On Mar 3, 1:43 am, BearState wixelb...@yahoo.com wrote: Hidie-ho, Well Ok, I've used setTimeout a few times in my code to delay resuming run of a code module until Ajax.Request() has had time to do its thing. And the use of the timer is cyclic as the user may repeat the operation over and over again, but in different parts of the page. And ... holy spacetime wormhole continuum out of wack batman! Why is that timer firing off so quickly? What in the wide wide world of sports is go'n on? Robin, haven't you done a web search yet? There's people complaining about memory leaks with regard to timers? Holy abscent minded browser batman! Is it the setTimeout() function causing the problem? Damned if I know Robin, I only stomp on Penquins and Jokers, not memory leaks and I'm not int he habit of waiting for anything, not even queues at the bank when I cash my checks. Holy Fast Food Diet out the window with Cheese, Fries and Shake Batman! What's the answer? You weren't listening Robin ... damned if I know. Does anyone know? BearState- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel tobie.lan...@gmail.com wrote: Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). I suggest you buy yourself a good book on Prototype[1] and maybe one on JavaScript too, while you're at it. ;) Best, Tobie [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... On Mar 3, 1:43 am, BearState wixelb...@yahoo.com wrote: Hidie-ho, Well Ok, I've used setTimeout a few times in my code to delay resuming run of a code module until Ajax.Request() has had time to do its thing. And the use of the timer is cyclic as the user may repeat the operation over and over again, but in different parts of the page. And ... holy spacetime wormhole continuum out of wack batman! Why is that timer firing off so quickly? What in the wide wide world of sports is go'n on? Robin, haven't you done a web search yet? There's people complaining about memory leaks with regard to timers? Holy abscent minded browser batman! Is it the setTimeout() function causing the problem? Damned if I know Robin, I only stomp on Penquins and Jokers, not memory leaks and I'm not int he habit of waiting for anything, not even queues at the bank when I cash my checks. Holy Fast Food Diet out the window with Cheese, Fries and Shake Batman! What's the answer? You weren't listening Robin ... damned if I know. Does anyone know? BearState- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: IE7 Timers Memory Leaks?
myTimeout=setTimeout(function(var,var2,var3,var4) { global x,y,z; alert('foo = bar'); },5000); whats wrong with that ? I dont think this leaks memory so why should any timeout leak memory Alex - Original Message - From: BearState wixelb...@yahoo.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Tuesday, March 03, 2009 3:36 AM Subject: [Proto-Scripty] Re: IE7 Timers Memory Leaks? Hi Tobie, You don't live over in Scott's Valley, do you? Used to know a Tobie way back when. OK so, xtimer = setTimeout( { doSomething( arg1, arg2, arg3 ); }, 500); is using the function's return? How do I specifiy a function to setTimeout when it has args? Holy Simple Minded Idiot Batman! It's not a timer memory leak problem. Riddle me this Robin ... do you think this programmer could use some Bat Belt and Suspenders? Holy Mistaken Bug Identity Batman! Definitely! BearState On Mar 2, 6:55 pm, Tobie Langel tobie.lan...@gmail.com wrote: Hi again, BearState. Your confusing different things here. The behaviour you are describing isn't related to memory leaks at all, your most probably just passing the _result_ of a function call to setTimeout rather than the function itself. In other words, if you are doing the following, you're almost certainly doing something wrong (or using some very obscure functional programming tricks): setTimeout(myFunc(), 1000); // WRONG This, on the contrary, works you're passing the function itself, not the _result_ of it): setTimeout(myFunc, 1000); // CORRECT Anyway, if you're doing ajax requests, you should NOT be using timeouts, but the provided callback system (as advised in a previous post). I suggest you buy yourself a good book on Prototype[1] and maybe one on JavaScript too, while you're at it. ;) Best, Tobie [1]http://prototypejs.org/2008/8/11/practical-prototype-and-scriptaculous orhttp://prototypejs.org/2007/5/7/prototype-and-script-aculo-us-the-bun... On Mar 3, 1:43 am, BearState wixelb...@yahoo.com wrote: Hidie-ho, Well Ok, I've used setTimeout a few times in my code to delay resuming run of a code module until Ajax.Request() has had time to do its thing. And the use of the timer is cyclic as the user may repeat the operation over and over again, but in different parts of the page. And ... holy spacetime wormhole continuum out of wack batman! Why is that timer firing off so quickly? What in the wide wide world of sports is go'n on? Robin, haven't you done a web search yet? There's people complaining about memory leaks with regard to timers? Holy abscent minded browser batman! Is it the setTimeout() function causing the problem? Damned if I know Robin, I only stomp on Penquins and Jokers, not memory leaks and I'm not int he habit of waiting for anything, not even queues at the bank when I cash my checks. Holy Fast Food Diet out the window with Cheese, Fries and Shake Batman! What's the answer? You weren't listening Robin ... damned if I know. Does anyone know? BearState- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---