Project

General

Profile

Actions

Bug #2279

closed

When embedding Ruby 1.9.1 it's impossible to disable GC

Added by romanbsd (Roman Shterenzon) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.1p291 (2009-10-25 revision 25484) [i386-darwin10.0.0]
Backport:
[ruby-core:26327]

Description

=begin
The function vm_xmalloc() will call garbage_collect_with_gvl() even if dont_gc is set by rb_gc_disable().
This is ok (though wastes some CPU cycles) when the code is running in native Ruby interpreter, as later the garbage_collect checks this flag.
What happens in embedded ruby, is that in garbage_collect_with_gvl() the ruby_native_thread_p() returns false, and the process exits with "[FATAL] failed to allocate memory" (so it seems, that the problem is even more serious, as if the GC is enabled, and the code which triggers GC is in C, then the program will exit as well).

I propose not to invoke garbage_collect_with_gvl in the first place, or, exit it right away if dont_gc is true.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0