+1, Kevin has a lot of experience with String semantics and optimizations, as well as with implementing & JIT-compiling many parts of Ruby, he would be a great committer.Eregon (Benoit Daloze)
nobu (Nobuyoshi Nakada) wrote in #note-1: > Does [GH-18495](https://github.com/ruby/ruby/pull/18495) fix it? Thank you for creating a fix. The easiest way to know would be to merge that PR, and `ruby-dev-builder` runs once per day. ...Eregon (Benoit Daloze)
headius (Charles Nutter) wrote in #note-7: > But your "failing" example only runs a single GC, which may not always be sufficient to clear the reference, in which case the size would not decrease. Ergo it's not deterministic and shouldn...Eregon (Benoit Daloze)
I bisected it to https://github.com/ruby/ruby/commit/b2feb09efe. This seems big to backport, and I agree it's not so important, so marking all versions as `WONTFIX`. `#size` is just `st_table_size(w->table)` so what changed is that purg...Eregon (Benoit Daloze)
My reproducer isn't prefect because the `1; []; 0` output would be correct if a GC happens at the start of `m.keys`, but we can disable the GC to resolve that concern and make it fully reliable. nobu (Nobuyoshi Nakada) wrote in #note-...Eregon (Benoit Daloze)
Both Java's `WeakHashMap` and JRuby's variant clean references in size(), so there is no issue there: https://github.com/openjdk/jdk/blob/05eaf783b270ec5cd901704c5e16b6201de7a9e4/src/java.base/share/classes/java/util/WeakHashMap.java#L3...Eregon (Benoit Daloze)
``` $ ruby -e 'GC.disable; m = ObjectSpace::WeakMap.new; Thread.new { m[Object.new] = Object.new }.join; GC.start; p m.size; p m.keys; p m.size' 1 [] 0 ``` The first line is 1 but I would expect 0. Interestingly calling `#keys`...Eregon (Benoit Daloze)
(https://github.com/ruby/prism/pull/4202) * This does not scale well with more find implementations. * RubyVM is CRuby-specific and experimental so not something usually exposed in public APIs. * Tests can use the specific class directl...Eregon (Benoit Daloze)