<?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>《近期遇到的3个Golang代码问题》的评论</title>
	<atom:link href="http://tonybai.com/2015/01/23/three-issues-about-go-code/feed/" rel="self" type="application/rss+xml" />
	<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/</link>
	<description>一个程序员的心路历程</description>
	<lastBuildDate>Wed, 25 Mar 2026 09:21:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>作者：nn</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-7569</link>
		<dc:creator>nn</dc:creator>
		<pubDate>Thu, 21 Oct 2021 09:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-7569</guid>
		<description>第一个问题建议在用 time.NewTicker 创建 Ticker，然后加一个 defer 来 Close，如果直接用 time.Tick 的话在 consumer goroutine 退出的时候 Ticker 不会被 GC，可能造成泄露。可以用 pprof 观察，会发现如果不 Close， goroutine 退出后依然存在 time.sendTime / runtime.epollwait。</description>
		<content:encoded><![CDATA[<p>第一个问题建议在用 time.NewTicker 创建 Ticker，然后加一个 defer 来 Close，如果直接用 time.Tick 的话在 consumer goroutine 退出的时候 Ticker 不会被 GC，可能造成泄露。可以用 pprof 观察，会发现如果不 Close， goroutine 退出后依然存在 time.sendTime / runtime.epollwait。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：bigwhite</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-6897</link>
		<dc:creator>bigwhite</dc:creator>
		<pubDate>Tue, 08 Aug 2017 03:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-6897</guid>
		<description>仍然会啊。这个是用法问题，创建了太多的ticker没有释放。你这种用法应该没有什么问题，只是创建了一个ticker而已。</description>
		<content:encoded><![CDATA[<p>仍然会啊。这个是用法问题，创建了太多的ticker没有释放。你这种用法应该没有什么问题，只是创建了一个ticker而已。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：joy</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-6896</link>
		<dc:creator>joy</dc:creator>
		<pubDate>Tue, 08 Aug 2017 02:24:57 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-6896</guid>
		<description>请问下第一个问题在1.8还会出现吗？
下面这种写法有问题吗？
for _ = range time.Tick(time.Second)</description>
		<content:encoded><![CDATA[<p>请问下第一个问题在1.8还会出现吗？<br />
下面这种写法有问题吗？<br />
for _ = range time.Tick(time.Second)</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：忠贞不渝</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-1115</link>
		<dc:creator>忠贞不渝</dc:creator>
		<pubDate>Sat, 15 Aug 2015 12:12:16 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-1115</guid>
		<description>ssss</description>
		<content:encoded><![CDATA[<p>ssss</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：colin</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-1092</link>
		<dc:creator>colin</dc:creator>
		<pubDate>Sat, 27 Jun 2015 05:03:47 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-1092</guid>
		<description>关于第1个问题，这应该是很明显可以看出来的吧？Tick的含义是定时触发，只需要一个就行了。如果放在循环内，必然是每次循环就创建一个Timer。这后果是可想而知的。</description>
		<content:encoded><![CDATA[<p>关于第1个问题，这应该是很明显可以看出来的吧？Tick的含义是定时触发，只需要一个就行了。如果放在循环内，必然是每次循环就创建一个Timer。这后果是可想而知的。</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：phpor</title>
		<link>https://tonybai.com/2015/01/23/three-issues-about-go-code/#comment-1050</link>
		<dc:creator>phpor</dc:creator>
		<pubDate>Fri, 27 Feb 2015 06:49:45 +0000</pubDate>
		<guid isPermaLink="false">http://tonybai.com/?p=1689#comment-1050</guid>
		<description>mark 一下 &lt;a href=&quot;http://tonybai.com/2015/01/23/three-issues-about-go-code/&quot; rel=&quot;nofollow&quot;&gt;http://tonybai.com/2015/01/23/three-issues-about-go-code/&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>mark 一下 <a href="http://tonybai.com/2015/01/23/three-issues-about-go-code/" rel="nofollow">http://tonybai.com/2015/01/23/three-issues-about-go-code/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
