https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112017-06-16T02:36:02ZRuby Issue Tracking SystemRuby master - Bug #13498: Weakref, Weakmap and define_finalizer don't work on frozen objectshttps://redmine.ruby-lang.org/issues/13498?journal_id=653852017-06-16T02:36:02Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<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>Weakref is implemented by finalizer to notify that an object is collected, and you can't define finalizers on frozen objects.<br>
Probably we need to move finalizer flags to a separate region (like bitmap marking).</p> Ruby master - Bug #13498: Weakref, Weakmap and define_finalizer don't work on frozen objectshttps://redmine.ruby-lang.org/issues/13498?journal_id=675752017-10-24T18:53:39ZRubyBugs (A Nonymous)msiegel@riverdaletechinc.com
<ul></ul><p>nobu (Nobuyoshi Nakada) wrote:</p>
<blockquote>
<p>Weakref is implemented by finalizer to notify that an object is collected, and you can't define finalizers on frozen objects.<br>
Probably we need to move finalizer flags to a separate region (like bitmap marking).</p>
</blockquote>
<p>Yes please. I also came here having discovered this independently, and also see it as a bug. It makes designs using frozen objects difficult to this friction with a leaky abstraction in the language implementation.</p>
<p>Unless I am mistaken, and mutating objects is an intentional part of the design of the GC system?</p> Ruby master - Bug #13498: Weakref, Weakmap and define_finalizer don't work on frozen objectshttps://redmine.ruby-lang.org/issues/13498?journal_id=787952019-06-22T15:37:11Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Frozen objects in WeakMap * gc.c (wmap_aset): bypass check for frozen and allow frozen object ..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/f3c81b4e90ec492382e299573f2c3ac272adbb5f">git|f3c81b4e90ec492382e299573f2c3ac272adbb5f</a>.</p>
<hr>
<p>Frozen objects in WeakMap</p>
<ul>
<li>gc.c (wmap_aset): bypass check for frozen and allow frozen<br>
object in WeakMap. [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Weakref, Weakmap and define_finalizer don't work on frozen objects (Closed)" href="https://redmine.ruby-lang.org/issues/13498">#13498</a>]</li>
</ul>