Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!xlned.com!feeder1.xlned.com!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1704778.3LbdHo29L0@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 08 Sep 2012 00:46:31 +0200 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <1399593.26SQpm16Mm@PointedEars.de> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 40 NNTP-Posting-Date: 08 Sep 2012 00:46:32 CEST NNTP-Posting-Host: 8839dd37.newsspool1.arcor-online.net X-Trace: DXC=WGBZ8aRTd57kUFX=Y?aLP;ic==]BZ:af>4Fo<]lROoR1nkgeX?EC@@0c43BI^Y;R17DZm8W4\YJN Thomas 'PointedEars' Lahn wrote: >> Tim Streater wrote: >> > And each time you call your ajax function you'll get a new one. >> Which is not a bad thing. >> >> > AIUI, although my knowledge of closures is a bit limited, each one will >> > live forever unless you explicitly dump it when you've finished with >> > it. By setting it to null, it'll get garbage-collected subsequently. > > I leave that to the browser to worry about. IOW, you are incompetent enough to not care about your users. >> Wishful thinking. There is no guarantee that garbage collection will >> commence before all browser windows are closed. > > [snip] > >> > request = null; >> >> With regard to memory efficiency and probably even runtime efficiency, it >> is far better to reuse an existing XHR object once the request has been >> processed. See JSX:http.js [1] for example. > > No doubt, but I may have several such requests outstanding at any given > moment and have no desire to manage a set of XHR objects. So you would rather not manage them and let them waste memory, one by one, eating it up until the browser application exits, in the worst case. Where is the logic in that? PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs,