Project

General

Profile

Actions

Bug #2279

closed

When embedding Ruby 1.9.1 it's impossible to disable GC

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

Status:
Closed
Priority:
Normal
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 #1

Updated by matz (Yukihiro Matsumoto) almost 13 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r25498.
Roman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions #2

Updated by romanbsd (Roman Shterenzon) almost 13 years ago

=begin
r21463 (originally r21441) still bothers me, as a GC which is triggered in C code of the embedding application (say rb_ary_new) will cause the application to exit with fatal error, as it's not ruby_native_thread_p(). Should I open a separate bug for this issue? Thank you in advance.
=end

Actions #3

Updated by matz (Yukihiro Matsumoto) almost 13 years ago

=begin
Hi,

In message "Re: [ruby-core:26356] [Bug #2279] When embedding Ruby 1.9.1 it's impossible to disable GC"
on Tue, 27 Oct 2009 16:09:49 +0900, Roman Shterenzon writes:

|r21463 (originally r21441) still bothers me, as a GC which is triggered in C code of the embedding application (say rb_ary_new) will cause the application to exit with fatal error, as it's not ruby_native_thread_p(). Should I open a separate bug for this issue? Thank you in advance.

I don't get the situation yet. Please file another bug.

						matz.

=end

Actions

Also available in: Atom PDF