<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AnnoMundi's Weblog &#187; Javascript</title>
	<atom:link href="http://www.annomundi.info/category/programming/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.annomundi.info</link>
	<description>AM, "in the year of the world"</description>
	<lastBuildDate>Mon, 20 Jul 2009 12:02:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>3 วิธีง่ายๆในการหลีกเลี่ยงปัญหา Memory Leak ใน JavaScript</title>
		<link>http://www.annomundi.info/2006/10/06/3-easy-steps-to-avoid-javascript-memory-leaks/</link>
		<comments>http://www.annomundi.info/2006/10/06/3-easy-steps-to-avoid-javascript-memory-leaks/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 01:56:31 +0000</pubDate>
		<dc:creator>AnnoMundi</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.annomundi.info/2006/10/06/20/</guid>
		<description><![CDATA[บทความเกี่ยวกับการหลีกเลี่ยงเขียน Javascript แล้วทำให้เกิด Memory Leak
หลักที่ผู้เขียนเขาแนะนำคือ
3. Set your XMLHttpRequest onreadystatechange handlers to null when you are done with them.
I use YAHOO.util.Connect for all my XHR connections and it uses a
polling mechanism instead of readstate, so I don’t need to do this
anymore. If you can switch to YAHOO.util.Connect (or
YAHOO.ext.UpdateManager built on top of it), I’d recommend it.
2. [...]]]></description>
			<content:encoded><![CDATA[<p>บทความเกี่ยวกับการหลีกเลี่ยงเขียน Javascript แล้วทำให้เกิด Memory Leak<br />
หลักที่ผู้เขียนเขาแนะนำคือ</p>
<blockquote><p><strong>3. Set your XMLHttpRequest onreadystatechange handlers to null when you are done with them.</strong></p>
<p>I use YAHOO.util.Connect for all my XHR connections and it uses a<br />
polling mechanism instead of readstate, so I don’t need to do this<br />
anymore. If you can switch to YAHOO.util.Connect (or<br />
YAHOO.ext.UpdateManager built on top of it), I’d recommend it.</p>
<p><strong>2. Clean up all your DOM event handlers on unload if there’s a chance they could reference a DOM object.</strong></p>
<p>There’s no reason to manually do this when there are libraries that<br />
do it automatically. I use YAHOO.util.Event for all my event handlers,<br />
it handles this for me automagically. Other libraries (prototype, dojo,<br />
etc) have some sort of mechanism to do the same thing, although I’m not<br />
sure how effective they are. If you look at the leak images above once<br />
again, you will notice almost all of them are in event related code of<br />
those libraries.</p>
<p><strong>1. Never put anything in a DOM expando or property other than a primitive value unless you plan on cleaning it up.</strong></p>
<p>This is the most important rule of all. It may seem convenient to<br />
put your JS object in a DOM expando, so you can $() and get it, but<br />
don’t do it. Sure, I know what you are thinking, I am being a little<br />
paranoid. There are lots of instances where putting a JS Object in a<br />
DOM expando <strong>won’t</strong> cause a leak. That’s true, but there are also<br />
many that will… some which are not so easy to detect (i.e. closures).<br />
So to avoid the possibility all together, I follow this simple rule.</p></blockquote>
<p>อ้างอิง: <a href="http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript-memory-leaks/">3 Easy Steps to Avoid JavaScript Memory Leaks</a><br />
<h3>บทความที่เกี่ยวข้อง</h3>
<ul class="related_post">
<li><a href="http://www.annomundi.info/2008/08/08/linux-console-command-part1/" title="Linux Console Command Part1">Linux Console Command Part1</a></li>
<li><a href="http://www.annomundi.info/2006/11/02/zend-framework-preview-020-released/" title="Zend Framework Preview 0.2.0 Released!">Zend Framework Preview 0.2.0 Released!</a></li>
<li><a href="http://www.annomundi.info/2006/11/01/zend-studio-55-beta-available-now/" title="Zend Studio 5.5 Beta Available Now!.">Zend Studio 5.5 Beta Available Now!.</a></li>
<li><a href="http://www.annomundi.info/2006/10/26/how-to-diable-tab-scrolling-in-firefox-20/" title="How to disable Tab Scrolling in FireFox 2.0">How to disable Tab Scrolling in FireFox 2.0</a></li>
<li><a href="http://www.annomundi.info/2006/10/18/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b9%81%e0%b8%81%e0%b9%89%e0%b8%9b%e0%b8%b1%e0%b8%8d%e0%b8%ab%e0%b8%b2-php-%e0%b8%aa%e0%b9%88%e0%b8%87%e0%b8%ad%e0%b8%b5%e0%b9%80%e0%b8%a1%e0%b8%a5%e0%b9%8c/" title="วิธีแก้ปัญหา PHP ส่งอีเมล์ไม่ได้บน Windows">วิธีแก้ปัญหา PHP ส่งอีเมล์ไม่ได้บน Windows</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.annomundi.info/2006/10/06/3-easy-steps-to-avoid-javascript-memory-leaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.066 seconds -->
