[ruby-core:88894] Re: [Ruby trunk Bug#15088] Leaky behaviour when GC disabled

From: Eric Wong <normalperson@...>
Date: 2018-09-07 21:01:29 UTC
List: ruby-core #88894
[email protected] wrote:
> https://bugs.ruby-lang.org/issues/15088

> 100_000.times do |i|
>   "to_sym_#{i}".to_sym
> end
> 
> GC.enable
> GC.start

You need at least another call to GC.start, here.

I think it is because global_symbols.dsymbol_fstr_hash (in
symbol.c) is a GC root, so rb_gc_free_dsymbol needs to be called
to remove the string from dsymbol_fstr_hash by the first
GC.start before the underlying fstring object in
vm->frozen_strings can be freed by the second GC.start call.

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next