<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Biggest AJAX problem</title>
	<atom:link href="http://ajaxian.com/archives/biggest-ajax-problem/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/biggest-ajax-problem</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Robbie MacKay</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-254268</link>
		<dc:creator>Robbie MacKay</dc:creator>
		<pubDate>Tue, 21 Aug 2007 23:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-254268</guid>
		<description>I get some bad cases of this. I run a plugin in firefox that restores my session each time I start the browser again. This becomes somewhat like not closing your browsers for weeks on end and when I keep tabs with AJAX apps open in them running that long them memory use is huge!</description>
		<content:encoded><![CDATA[<p>I get some bad cases of this. I run a plugin in firefox that restores my session each time I start the browser again. This becomes somewhat like not closing your browsers for weeks on end and when I keep tabs with AJAX apps open in them running that long them memory use is huge!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 7blfrsglg</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-69516</link>
		<dc:creator>7blfrsglg</dc:creator>
		<pubDate>Thu, 17 Aug 2006 21:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-69516</guid>
		<description>hdv2pvs7ish5</description>
		<content:encoded><![CDATA[<p>hdv2pvs7ish5</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-55268</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Thu, 27 Jul 2006 14:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-55268</guid>
		<description>Mark, sorry so late in replying to that last Q... I don&#039;t think that will work, bud. I believe Event.stopObserving (also meaning the underlying DOM2 event model) requires a handle (or pointer) to the same function as the observe method (same memory address) to work correctly.  Remember bind() and bindAsEventListener() return closures (anonymous functions), so you&#039;d be passing in a newly created and different function (meaning different memory address) into the stopObserving method than you did to the observe method. I believe your method would work if you were passing in globally scoped, static function names. As with anything, try it and analyze the results to get an understanding of what&#039;s going on under the covers :-).</description>
		<content:encoded><![CDATA[<p>Mark, sorry so late in replying to that last Q&#8230; I don&#8217;t think that will work, bud. I believe Event.stopObserving (also meaning the underlying DOM2 event model) requires a handle (or pointer) to the same function as the observe method (same memory address) to work correctly.  Remember bind() and bindAsEventListener() return closures (anonymous functions), so you&#8217;d be passing in a newly created and different function (meaning different memory address) into the stopObserving method than you did to the observe method. I believe your method would work if you were passing in globally scoped, static function names. As with anything, try it and analyze the results to get an understanding of what&#8217;s going on under the covers :-).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Sergienko</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54772</link>
		<dc:creator>Mark Sergienko</dc:creator>
		<pubDate>Wed, 26 Jul 2006 15:38:27 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54772</guid>
		<description>Ryan,
hehe, nice job buddy. 
I&#039;ll write off on results..
And one more question
If you do like 
Event.observe(&quot;element&quot;, &quot;click&quot;, this.myhandler.bindAsEventListener(this));
and then 
Event.stopObserving(&quot;element&quot;, &quot;click&quot;, this.myhandler.bindAsEventListener(this));
Does it make a huge difference without saving event handlers and then reseting them? 

Thanks again.</description>
		<content:encoded><![CDATA[<p>Ryan,<br />
hehe, nice job buddy.<br />
I&#8217;ll write off on results..<br />
And one more question<br />
If you do like<br />
Event.observe(&#8220;element&#8221;, &#8220;click&#8221;, this.myhandler.bindAsEventListener(this));<br />
and then<br />
Event.stopObserving(&#8220;element&#8221;, &#8220;click&#8221;, this.myhandler.bindAsEventListener(this));<br />
Does it make a huge difference without saving event handlers and then reseting them? </p>
<p>Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54758</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Wed, 26 Jul 2006 14:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54758</guid>
		<description>Mark, did you notice I wrote that article :-)</description>
		<content:encoded><![CDATA[<p>Mark, did you notice I wrote that article :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Sergienko</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54284</link>
		<dc:creator>Mark Sergienko</dc:creator>
		<pubDate>Tue, 25 Jul 2006 23:19:42 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54284</guid>
		<description>Ryan, 
Thanks alot, i also found an article on that, and almost refined all of my code by the time, 
http://www.archivesat.com/Rails_spinoffs/thread392813.htm  explains the pattern, 
so I&#039;m going to delete references as well, and so far can keep FF memory on level, though IE still have some glitches. (Mainly i think because the way i implemented Google Maps Api)

Thanks for explanation again</description>
		<content:encoded><![CDATA[<p>Ryan,<br />
Thanks alot, i also found an article on that, and almost refined all of my code by the time,<br />
<a href="http://www.archivesat.com/Rails_spinoffs/thread392813.htm" rel="nofollow">http://www.archivesat.com/Rails_spinoffs/thread392813.htm</a>  explains the pattern,<br />
so I&#8217;m going to delete references as well, and so far can keep FF memory on level, though IE still have some glitches. (Mainly i think because the way i implemented Google Maps Api)</p>
<p>Thanks for explanation again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Personal Interactive</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54137</link>
		<dc:creator>Personal Interactive</dc:creator>
		<pubDate>Tue, 25 Jul 2006 20:33:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54137</guid>
		<description>I actually agree with you on your final point</description>
		<content:encoded><![CDATA[<p>I actually agree with you on your final point</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54135</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Tue, 25 Jul 2006 20:20:47 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54135</guid>
		<description>Mark, 
1) Using prototype as the example, and assuming &quot;this&quot; is an object representing your component/control/widget... notice that you should always create a handle to your event handling functions, so you can properly dispose of them using Event.stopObserving (and then remember to set the handle to null to remove all references). You can dispose of the event handlers and DOM references before you make the AJAX call, which must be a synchronous operation to be reliable, OR you can implement a DOM reference abstraction layer and pass the cleanup process to an asynchronous garbage collector object. The latter is better overall for performance of the app, but the former is easier to implement.
&lt;code&gt;
this.someEventHandler = this.doSomething.bindAsEventHandler(this);
Event.observe($(&#039;someElement&#039;), &quot;click&quot;, this.someEventHandler);

//..and then later in the dispose method, either before the call which would result in this DOM fragment being over-written, or asynchronously via the DOM referencing abstraction/GC layer...

Event.stopObserving($(&#039;someElement&#039;), &quot;click&quot;, this.someEventHandler);
this.someEventHandler = null;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Mark,<br />
1) Using prototype as the example, and assuming &#8220;this&#8221; is an object representing your component/control/widget&#8230; notice that you should always create a handle to your event handling functions, so you can properly dispose of them using Event.stopObserving (and then remember to set the handle to null to remove all references). You can dispose of the event handlers and DOM references before you make the AJAX call, which must be a synchronous operation to be reliable, OR you can implement a DOM reference abstraction layer and pass the cleanup process to an asynchronous garbage collector object. The latter is better overall for performance of the app, but the former is easier to implement.<br />
<code><br />
this.someEventHandler = this.doSomething.bindAsEventHandler(this);<br />
Event.observe($('someElement'), "click", this.someEventHandler);</p>
<p>//..and then later in the dispose method, either before the call which would result in this DOM fragment being over-written, or asynchronously via the DOM referencing abstraction/GC layer...</p>
<p>Event.stopObserving($('someElement'), "click", this.someEventHandler);<br />
this.someEventHandler = null;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Sergienko</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54131</link>
		<dc:creator>Mark Sergienko</dc:creator>
		<pubDate>Tue, 25 Jul 2006 20:08:04 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54131</guid>
		<description>Hi,
could someone make it clear
1) Do you need to unset events binded with Event.observe() (prototype.js) Once the corresponding piece is refreshed with ajax call?
2) What is cross-browser way to unload iframes? (and check if they&#039;re loaded)

Thanks in advance</description>
		<content:encoded><![CDATA[<p>Hi,<br />
could someone make it clear<br />
1) Do you need to unset events binded with Event.observe() (prototype.js) Once the corresponding piece is refreshed with ajax call?<br />
2) What is cross-browser way to unload iframes? (and check if they&#8217;re loaded)</p>
<p>Thanks in advance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remus Stratulat</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54126</link>
		<dc:creator>Remus Stratulat</dc:creator>
		<pubDate>Tue, 25 Jul 2006 19:52:59 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54126</guid>
		<description>@Nick: I am primarily a Java developer. The Java GC does a very good job but even it can not solve all the problems. A good developer or a good architect should not overlook this problem any more. 
     No matter how good a GC will become there is a boundary that it will not cross and that boundary is cleaning objects that you are using. Defining that boundary is the biggest challenge a VM designer must tackle. 
     When the browser closes a page the line between used objects and unused ones is simple and clear. When the page resides in a browser for a longer period of time the GC may have a hard time in defining the used and unused references. If the developer does not take the necessary precautions in cleaning after himself the GC will not be able to perform its job.</description>
		<content:encoded><![CDATA[<p>@Nick: I am primarily a Java developer. The Java GC does a very good job but even it can not solve all the problems. A good developer or a good architect should not overlook this problem any more.<br />
     No matter how good a GC will become there is a boundary that it will not cross and that boundary is cleaning objects that you are using. Defining that boundary is the biggest challenge a VM designer must tackle.<br />
     When the browser closes a page the line between used objects and unused ones is simple and clear. When the page resides in a browser for a longer period of time the GC may have a hard time in defining the used and unused references. If the developer does not take the necessary precautions in cleaning after himself the GC will not be able to perform its job.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54098</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Tue, 25 Jul 2006 19:04:55 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54098</guid>
		<description>@Kevin: Interesting, I honestly fell by a very similar technique by my own accord (I swear), with DOM referencing and cleanup across incremental partial page updates (via componentized MVC model) abstracted, and a global GC system.

@Sam: The answer is yes and yes. Yes, much of this stuff is considered proprietary to those who have discovered it, packaged it, and are trying to sell it, and yes, it&#039;s all part and parcel to the learning curve of this new frontier. As you move through what is possible, you start running into problems. Problems are nothing more than opportunities to find novel solutions. If you are like some, once you find those novel solutions, you see dollar signs :-). It&#039;s not about hiding things from people on purpose to oppress them though, it&#039;s about timing and opportunity.</description>
		<content:encoded><![CDATA[<p>@Kevin: Interesting, I honestly fell by a very similar technique by my own accord (I swear), with DOM referencing and cleanup across incremental partial page updates (via componentized MVC model) abstracted, and a global GC system.</p>
<p>@Sam: The answer is yes and yes. Yes, much of this stuff is considered proprietary to those who have discovered it, packaged it, and are trying to sell it, and yes, it&#8217;s all part and parcel to the learning curve of this new frontier. As you move through what is possible, you start running into problems. Problems are nothing more than opportunities to find novel solutions. If you are like some, once you find those novel solutions, you see dollar signs :-). It&#8217;s not about hiding things from people on purpose to oppress them though, it&#8217;s about timing and opportunity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam Foster</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54067</link>
		<dc:creator>Sam Foster</dc:creator>
		<pubDate>Tue, 25 Jul 2006 17:48:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54067</guid>
		<description>@Kevin: that&#039;s interesting. I&#039;d read about your 2 DOM approach before, but hadn&#039;t really understood it in this context. This is the kind of thing I&#039;m fishing for: real tried-and-tested patterns that address the core problem. The event cache is another - implemented in Dojo and Prototype among others. And higher level widgets are another - which provide a consistent interface which includes a destroy method that can get called automatically or as necessary to re-draw/re-purpose the screen. What else is out there? 

My impression for the last year or so has been that a lot of work has gone into getting folks started with ajax, but much of the work that ensures success is still behind closed doors. Is this really critical competitive advantage that is being deliberately withheld? Or is it simply that most of us are still in early development phases and finding this stuff out as we go along. 

As we each move from the general to the specific in our development, its understood that a lot of the lessons learned are exclusive to the particular application we&#039;re working on. But many are not. I&#039;m looking for good accounts of the end-game. The postings around the Yahoo Homepage change / @media presentation were valuable in providing candid information on the problems that team faced and how they solved them. Performance and memory management are bugbears that we all face. Are there any more good resources out there that address these issues?</description>
		<content:encoded><![CDATA[<p>@Kevin: that&#8217;s interesting. I&#8217;d read about your 2 DOM approach before, but hadn&#8217;t really understood it in this context. This is the kind of thing I&#8217;m fishing for: real tried-and-tested patterns that address the core problem. The event cache is another &#8211; implemented in Dojo and Prototype among others. And higher level widgets are another &#8211; which provide a consistent interface which includes a destroy method that can get called automatically or as necessary to re-draw/re-purpose the screen. What else is out there? </p>
<p>My impression for the last year or so has been that a lot of work has gone into getting folks started with ajax, but much of the work that ensures success is still behind closed doors. Is this really critical competitive advantage that is being deliberately withheld? Or is it simply that most of us are still in early development phases and finding this stuff out as we go along. </p>
<p>As we each move from the general to the specific in our development, its understood that a lot of the lessons learned are exclusive to the particular application we&#8217;re working on. But many are not. I&#8217;m looking for good accounts of the end-game. The postings around the Yahoo Homepage change / @media presentation were valuable in providing candid information on the problems that team faced and how they solved them. Performance and memory management are bugbears that we all face. Are there any more good resources out there that address these issues?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Husher</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54059</link>
		<dc:creator>Nick Husher</dc:creator>
		<pubDate>Tue, 25 Jul 2006 17:44:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54059</guid>
		<description>Forgive me for being a noob, but what exact cases are there where memory isn&#039;t being deallocated properly? Previous comments allude to DOM nodes that are not in the document tree not deallocating when the fall out of scope. Is this really the case? If so, isn&#039;t this primarily an issue with the browser-specific implementations of the JS GC?

In any case, it doesn&#039;t appear that there&#039;s an easy way of tracking such a thing with modern JS debugging tools...</description>
		<content:encoded><![CDATA[<p>Forgive me for being a noob, but what exact cases are there where memory isn&#8217;t being deallocated properly? Previous comments allude to DOM nodes that are not in the document tree not deallocating when the fall out of scope. Is this really the case? If so, isn&#8217;t this primarily an issue with the browser-specific implementations of the JS GC?</p>
<p>In any case, it doesn&#8217;t appear that there&#8217;s an easy way of tracking such a thing with modern JS debugging tools&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Hakman</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54036</link>
		<dc:creator>Kevin Hakman</dc:creator>
		<pubDate>Tue, 25 Jul 2006 16:44:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54036</guid>
		<description>Here at TIBCO in the TIBCO General Interface AJAX RIA toolkit, we addressed the memory issue for AJAX back in 2001.  The solution we found was to implement an abstration layer for the native DOM, managed by a client-side controller in a MVC paradigm.  Thus adding and removing from the higher level DOM, managed through the controller enabled the controller to manage clean up of objects and memory in a more predictable and manageable way.  Keep in mind this technique was used to support Web applications that look and perform like desktop GUIs as opposed to slight enhancements here and there in the context of HTML pages (e.g. Client/SOA ajax as opposed to Enriched HTML page ajax).  This &quot;2 DOM&quot; approach as early as 2001 was suffucuent to power chemogenomic drug disovery solutions deployed to the USFDA and major pharma companies.  That solutions was very data instensive and loaded/unloaded about 180 various application modules over lengthy (multiple hour) sessions.  There&#039;s a recording including discussion about that solution here: http://www2.sys-con.com/webinararchive.cfm?registered=on&amp;pid=61</description>
		<content:encoded><![CDATA[<p>Here at TIBCO in the TIBCO General Interface AJAX RIA toolkit, we addressed the memory issue for AJAX back in 2001.  The solution we found was to implement an abstration layer for the native DOM, managed by a client-side controller in a MVC paradigm.  Thus adding and removing from the higher level DOM, managed through the controller enabled the controller to manage clean up of objects and memory in a more predictable and manageable way.  Keep in mind this technique was used to support Web applications that look and perform like desktop GUIs as opposed to slight enhancements here and there in the context of HTML pages (e.g. Client/SOA ajax as opposed to Enriched HTML page ajax).  This &#8220;2 DOM&#8221; approach as early as 2001 was suffucuent to power chemogenomic drug disovery solutions deployed to the USFDA and major pharma companies.  That solutions was very data instensive and loaded/unloaded about 180 various application modules over lengthy (multiple hour) sessions.  There&#8217;s a recording including discussion about that solution here: <a href="http://www2.sys-con.com/webinararchive.cfm?registered=on&#038;pid=61" rel="nofollow">http://www2.sys-con.com/webinararchive.cfm?registered=on&#038;pid=61</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-54004</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Tue, 25 Jul 2006 15:55:04 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-54004</guid>
		<description>@Peter: Even very good garbage collected languages will have cases where resources are being accessed outside of the managed environment, in which case there is no alternative other than the developer writing custom finalizers (dispose methods) on their objects, and ensuring that they get called when appropraite. For js UI components this amounts to setting DOM element references and event handler references to null. One approach, as I&#039;ve alluded to, is creating a custom AJAX control garbage collector that handles this process in the background. Once that system is built into the application architecture, it makes it slightly easier for the developers; they just write the finalizer methods for each component and the system handles when those methods get called.

@Alexandru: Sorry, wasn&#039;t implying you didn&#039;t know good programming practices :-)... agreed that there are oh-too-many designers/amateurs trying to handle application development with very little concern for architecture. Even though much of the application has potentially migrated to the client, this does not mean we can do away with the developers, it just means the developers need to learn this environment, and let the designers do what they do best, design.</description>
		<content:encoded><![CDATA[<p>@Peter: Even very good garbage collected languages will have cases where resources are being accessed outside of the managed environment, in which case there is no alternative other than the developer writing custom finalizers (dispose methods) on their objects, and ensuring that they get called when appropraite. For js UI components this amounts to setting DOM element references and event handler references to null. One approach, as I&#8217;ve alluded to, is creating a custom AJAX control garbage collector that handles this process in the background. Once that system is built into the application architecture, it makes it slightly easier for the developers; they just write the finalizer methods for each component and the system handles when those methods get called.</p>
<p>@Alexandru: Sorry, wasn&#8217;t implying you didn&#8217;t know good programming practices :-)&#8230; agreed that there are oh-too-many designers/amateurs trying to handle application development with very little concern for architecture. Even though much of the application has potentially migrated to the client, this does not mean we can do away with the developers, it just means the developers need to learn this environment, and let the designers do what they do best, design.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remus Stratulat</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-53984</link>
		<dc:creator>Remus Stratulat</dc:creator>
		<pubDate>Tue, 25 Jul 2006 15:47:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-53984</guid>
		<description>Yes, JavaScript is a GC language. And yes, some times the browser GC or JSVM does not do a good job in cleaning the memory.  I found a reference about it in this article: http://www.bazon.net/mishoo/home.epl?NEWS_ID=1281

However, the job of a JavaScript programmer has become more difficult in the AJAX era and that is the focus of my article. In the old days a JavaScript programmer was comfortable enough in being sloppy with the objects he was creating as the browser was cleaning everything up when the page was reloaded.  When you are developing a single page AJAX application everything is loaded and created in the same scope. If the programmer does not take care to â€œnullâ€ everything that he has created when he no longer needs it then you have a big problem. Not to mention about unregistering all the listeners from all the events. It is very easy to get lost in the referencing scheme. So unfortunately the JavaScript developers arenâ€™t doing a good job of garbage collection.

There are 8 millions html developers and each one of them will think sooner or later to get his hand dirty with some AJAX. They will pull some content from the server and create a bunch of objects and register events to them. After that they will pull some more content from server and do the same thing on the same page. What do you think has happened with the objects he first created? They will continue to linger in a â€œno objects landâ€ inside the JSVM, ghostsâ€¦ memory leaks.</description>
		<content:encoded><![CDATA[<p>Yes, JavaScript is a GC language. And yes, some times the browser GC or JSVM does not do a good job in cleaning the memory.  I found a reference about it in this article: <a href="http://www.bazon.net/mishoo/home.epl?NEWS_ID=1281" rel="nofollow">http://www.bazon.net/mishoo/home.epl?NEWS_ID=1281</a></p>
<p>However, the job of a JavaScript programmer has become more difficult in the AJAX era and that is the focus of my article. In the old days a JavaScript programmer was comfortable enough in being sloppy with the objects he was creating as the browser was cleaning everything up when the page was reloaded.  When you are developing a single page AJAX application everything is loaded and created in the same scope. If the programmer does not take care to â€œnullâ€ everything that he has created when he no longer needs it then you have a big problem. Not to mention about unregistering all the listeners from all the events. It is very easy to get lost in the referencing scheme. So unfortunately the JavaScript developers arenâ€™t doing a good job of garbage collection.</p>
<p>There are 8 millions html developers and each one of them will think sooner or later to get his hand dirty with some AJAX. They will pull some content from the server and create a bunch of objects and register events to them. After that they will pull some more content from server and do the same thing on the same page. What do you think has happened with the objects he first created? They will continue to linger in a â€œno objects landâ€ inside the JSVM, ghostsâ€¦ memory leaks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandru COSTIN</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-53953</link>
		<dc:creator>Alexandru COSTIN</dc:creator>
		<pubDate>Tue, 25 Jul 2006 15:31:37 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-53953</guid>
		<description>Hi Ryan,
I know about sound programming practices, but I&#039;m in the web development business (selling tools), and I can assure you that there are very few developers and senior developers there, while there are millions of newbies that want to do Ajax and that are actually deploying live websites

As for the reloading experience, we&#039;ve analyzed in depth the Gmail experience when doing Ajax navigation. While we suppose only data in exchanged with the server, the page refresh process is the following:
Change cursor to &quot;waiting&quot;Show Red Loading Label in the upper rightShow white pageShow new page
I presume that the experience for the user was ok as actually nobody saw this :)

And for managing the states, we&#039;re trying to solve the application state problem in our framework, solving this developer problems automatically. But indeed, it was a very, very difficult problem to solve.

Let&#039;s just wait and see how good web developers/newbies will get in learning advanced programming techniques, or whether the browsers will get better in improving the JS GC

Alexandru</description>
		<content:encoded><![CDATA[<p>Hi Ryan,<br />
I know about sound programming practices, but I&#8217;m in the web development business (selling tools), and I can assure you that there are very few developers and senior developers there, while there are millions of newbies that want to do Ajax and that are actually deploying live websites</p>
<p>As for the reloading experience, we&#8217;ve analyzed in depth the Gmail experience when doing Ajax navigation. While we suppose only data in exchanged with the server, the page refresh process is the following:<br />
Change cursor to &#8220;waiting&#8221;Show Red Loading Label in the upper rightShow white pageShow new page<br />
I presume that the experience for the user was ok as actually nobody saw this :)</p>
<p>And for managing the states, we&#8217;re trying to solve the application state problem in our framework, solving this developer problems automatically. But indeed, it was a very, very difficult problem to solve.</p>
<p>Let&#8217;s just wait and see how good web developers/newbies will get in learning advanced programming techniques, or whether the browsers will get better in improving the JS GC</p>
<p>Alexandru</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bogdan Ripa</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-53947</link>
		<dc:creator>Bogdan Ripa</dc:creator>
		<pubDate>Tue, 25 Jul 2006 15:28:14 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-53947</guid>
		<description>One of the biggest problems I see is that there is no (reasonable) way to removeEventListeners in JavaScript.

Imagine some DOM elements that have listeners attached. Then, the DOM elements are removed, but the events remain attached...

I had this kind of problems when implementing a simple tooltip engine, where after removing the target elements from the DOM, the tooltip elements were still there, and no GC engine would remove those...

So at the end, it&#039;s a question of good programming and a good GC.

Bogdan</description>
		<content:encoded><![CDATA[<p>One of the biggest problems I see is that there is no (reasonable) way to removeEventListeners in JavaScript.</p>
<p>Imagine some DOM elements that have listeners attached. Then, the DOM elements are removed, but the events remain attached&#8230;</p>
<p>I had this kind of problems when implementing a simple tooltip engine, where after removing the target elements from the DOM, the tooltip elements were still there, and no GC engine would remove those&#8230;</p>
<p>So at the end, it&#8217;s a question of good programming and a good GC.</p>
<p>Bogdan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Harkins</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-53922</link>
		<dc:creator>Peter Harkins</dc:creator>
		<pubDate>Tue, 25 Jul 2006 15:01:42 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-53922</guid>
		<description>The moral of the story here is not &quot;Javascript developers aren&#039;t doing a good job of garbage collection&quot;, it&#039;s &quot;Browser developers aren&#039;t doing a godo job of garbage collection&quot;.

There&#039;s no malloc in JS, it&#039;s supposed to be a gc language. These are interpreter bugs that JS coders are having to work around.</description>
		<content:encoded><![CDATA[<p>The moral of the story here is not &#8220;Javascript developers aren&#8217;t doing a good job of garbage collection&#8221;, it&#8217;s &#8220;Browser developers aren&#8217;t doing a godo job of garbage collection&#8221;.</p>
<p>There&#8217;s no malloc in JS, it&#8217;s supposed to be a gc language. These are interpreter bugs that JS coders are having to work around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Gahl</title>
		<link>http://ajaxian.com/archives/biggest-ajax-problem/comment-page-1#comment-53917</link>
		<dc:creator>Ryan Gahl</dc:creator>
		<pubDate>Tue, 25 Jul 2006 14:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/biggest-ajax-problem#comment-53917</guid>
		<description>Sam, the best way to prevent leaks is look at your architecture as a whole. The best &quot;tool&quot; is good application design from the bottom up. If you are poring through files that are filled with markup, server code, and javascript throughout, looking for all the individual places where there might be a circular reference or potential leak, then yes, you can never really be sure you got them all. If your design is clean, with good separation of concerns, and controls are componentized then memory management will fall right in.</description>
		<content:encoded><![CDATA[<p>Sam, the best way to prevent leaks is look at your architecture as a whole. The best &#8220;tool&#8221; is good application design from the bottom up. If you are poring through files that are filled with markup, server code, and javascript throughout, looking for all the individual places where there might be a circular reference or potential leak, then yes, you can never really be sure you got them all. If your design is clean, with good separation of concerns, and controls are componentized then memory management will fall right in.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

