[#41916] Proposal: Bitmap Marking GC — Narihiro Nakamura <authornari@...>

Hi.

18 messages 2012/01/05

[#41941] [ruby-trunk - Bug #5851][Open] make check fails when compiling with GCC 4.7 - *** longjmp causes uninitialized stack frame *** — Vit Ondruch <v.ondruch@...>

12 messages 2012/01/06

[#41979] [ruby-trunk - Bug #5865][Open] Exception#== should return false if the classes differ — Hiro Asari <asari.ruby@...>

10 messages 2012/01/08

[#42003] [ruby-trunk - Bug #5871][Open] regexp \W matches some word characters when inside a case-insensitive character class — Gareth Adams <gareth@...>

14 messages 2012/01/09

[#42016] [ruby-trunk - Feature #5873][Open] Adopt FFI over DL — Heesob Park <phasis@...>

15 messages 2012/01/10

[#42149] [ruby-trunk - Feature #5899][Open] chaining comparsions. — Ondrej Bilka <neleai@...>

12 messages 2012/01/16

[#42164] [ruby-trunk - Feature #5903][Open] Optimize st_table (take 2) — Yura Sokolov <funny.falcon@...>

18 messages 2012/01/17

[ruby-core:42243] [ruby-trunk - Bug #5901] OpenBSD "[FATAL] failed to allocate memory"

From: Narihiro Nakamura <authorNari@...>
Date: 2012-01-27 05:22:07 UTC
List: ruby-core #42243
Issue #5901 has been updated by Narihiro Nakamura.


Hi.

I make the following patch. Is it acceptable?

diff --git a/configure.in b/configure.in
index 085dfcf..f41ef3b 100644
--- a/configure.in
+++ b/configure.in
@@ -1292,6 +1292,13 @@ main() {
 CFLAGS="$save_CFLAGS"])
 AC_DEFINE_UNQUOTED(GC_MARK_STACKFRAME_WORD, $rb_cv_gc_mark_stackframe_word)
 
+AS_CASE(["$target_os"],
+[openbsd*], [
+    AC_DEFINE_UNQUOTED(HEAP_ALIGN_LOG, 12)
+    AC_DEFINE_UNQUOTED(HEAP_ALIGN, 0x1000)
+    AC_DEFINE_UNQUOTED(HEAP_ALIGN_MASK, 0x0fff)
+    ])
+
 
 dnl Checks for library functions.
 AC_TYPE_GETGROUPS
diff --git a/gc.c b/gc.c
index 4c906e7..b90cf35 100644
--- a/gc.c
+++ b/gc.c
@@ -536,10 +536,13 @@ rb_objspace_free(rb_objspace_t *objspace)
 }
 #endif
 
-/* tiny heap size: 16KB */
+#ifndef HEAP_ALIGN_LOG
+/* default tiny heap size: 16KB */
 #define HEAP_ALIGN_LOG 14
 #define HEAP_ALIGN 0x4000
 #define HEAP_ALIGN_MASK 0x3fff
+#endif
+
 #define REQUIRED_SIZE_BY_MALLOC (sizeof(size_t) * 5)
 #define HEAP_SIZE (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC)
----------------------------------------
Bug #5901: OpenBSD "[FATAL] failed to allocate memory"
https://bugs.ruby-lang.org/issues/5901

Author: George Koehler
Status: Assigned
Priority: Normal
Assignee: Narihiro Nakamura
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2012-01-16 trunk 34316) [x86_64-openbsd5.0]


=begin
Ruby trunk fails to build with OpenBSD. During the build, miniruby fails with message
 [FATAL] failed to allocate memory

OpenBSD has a broken posix_memalign(). Ruby fails in gc.c, because posix_memalign() fails and aligned_malloc() returns NULL. OpenBSD's manual for posix_memalign ((<URL:http://xrl.us/bmow7c>)) says:

 BUGS
      Only alignments up to the page size can be specified.

Ruby wants alignment of 16 kilobytes, but my page size is only 4 kilobytes.

I tried to edit gc.c. My first attempt (bad-fix-never-apply.diff) was good enough to build Ruby, but it did not always work, and some tests failed. So I reverted gc.c and tried again.

My second attempt (smaller-heap-for-openbsd.diff) was much simpler. I changed the values of HEAP_ALIGN*, shrinking the heap size from 16 kilobytes to 4 kilobytes, which is not larger than my page size. More tests pass. The only failures in 'make test' are in bootstraptest/test_thread.rb. Those tests seem to create an infinite loop in Ruby, and I needed to kill -9 those processes. Some tests in 'make test-all' failed the same way, with the infinite loop.
=end



-- 
http://bugs.ruby-lang.org/

In This Thread