https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-05-25T07:16:08ZRuby Issue Tracking SystemBackport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112122010-05-25T07:16:08Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin<br>
Was able to reproduce with<br>
ruby 1.9.3dev (2010-05-22) [i386-mingw32]<br>
=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112132010-05-25T09:42:28Zhdm (HD Moore)hdm@metasploit.com
<ul></ul><p>=begin<br>
The patch below fixes this memory leak</p>
<a name="Index-ioc"></a>
<h1 >Index: io.c<a href="#Index-ioc" class="wiki-anchor">¶</a></h1>
<p>--- io.c (revision 27934)<br>
+++ io.c (working copy)<br>
@@ -7297,6 +7297,7 @@<br>
rb_f_select(int argc, VALUE *argv, VALUE obj)<br>
{<br>
VALUE timeout;</p>
<ul>
<li>VALUE r;<br>
struct select_args args;<br>
struct timeval timerec;<br>
int i;<br>
@@ -7316,8 +7317,12 @@<br>
#ifdef HAVE_RB_FD_INIT<br>
return rb_ensure(select_call, (VALUE)&args, select_end, (VALUE)&args);<br>
#else</li>
</ul>
<ul>
<li>return select_internal(args.read, args.write, args.except,</li>
<li>
<pre><code> args.timeout, args.fdsets);
</code></pre>
</li>
</ul>
<ul>
<li>r = select_internal(args.read, args.write, args.except, args.timeout, args.fdsets);</li>
<li>
<li>for (i = 0; i < numberof(args.fdsets); ++i)</li>
<li>rb_fd_term(&args.fdsets[i]);</li>
<li>
<li>return(r);<br>
#endif</li>
</ul>
<p>}</p>
<p>=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112142010-05-25T10:32:30Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>nobu (Nobuyoshi Nakada)</i></li></ul><p>=begin<br>
mingw only (VC++ version doesn't have this problem)</p>
<p>Nobu, I think that you should define HAVE_RB_FD_INIT in configure for mingw.<br>
=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112182010-05-25T12:15:33Zhdm (HD Moore)hdm@metasploit.com
<ul></ul><p>=begin<br>
Strangely, rb_fd_init() is being used before the #ifdef block; it does not make sense for this function to call the select_internal() unless the fb_fd_init()'s are similarly ifdef'd (any platform without HAVE_RB_FD_INIT will experience a memory leak).<br>
=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112192010-05-25T12:48:07Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>=begin<br>
Hello,</p>
<p>In message "<a href="https://blade.ruby-lang.org/ruby-core/30407">[ruby-core:30407]</a> [Bug <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: Memory leak in IO.select() on Windows (Closed)" href="https://redmine.ruby-lang.org/issues/3336">#3336</a>] Memory leak in IO.select() on Windows"<br>
on May.25,2010 12:15:33, <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a> wrote:</p>
<blockquote>
<p>Strangely, rb_fd_init() is being used before the #ifdef block; it does not make sense for this function to call the select_internal() unless the fb_fd_init()'s are similarly ifdef'd (any platform without HAVE_RB_FD_INIT will experience a memory leak).</p>
</blockquote>
<p>I think that HAVE_RB_FD_INIT is not a good name.<br>
It's used as the indicator of a necessity to call rb_fd_term().</p>
<a name="Regards"></a>
<h2 >Regards,<a href="#Regards" class="wiki-anchor">¶</a></h2>
<p>U.Nakamura <a href="mailto:usa@garbagecollect.jp" class="email">usa@garbagecollect.jp</a></p>
<p>=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112242010-05-25T13:27:15Zhdm (HD Moore)hdm@metasploit.com
<ul></ul><p>=begin<br>
Thank you for the explanation - that makes much more sense :)<br>
=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112452010-05-26T10:37:06Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
This issue was solved with changeset r28016.<br>
HD, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<p>=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112462010-05-26T11:40:08Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Category</strong> set to <i>core</i></li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>nobu (Nobuyoshi Nakada)</i> to <i>yugui (Yuki Sonoda)</i></li></ul><p>=begin</p>
<p>=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=112712010-05-27T01:16:20Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>=begin<br>
Seems fixed now in mingw. Thanks!<br>
=end</p> Backport191 - Backport #3336: Memory leak in IO.select() on Windowshttps://redmine.ruby-lang.org/issues/3336?journal_id=796122019-07-15T19:20:19Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/79612/diff?detail_id=53333">diff</a>)</li><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul>