Project

General

Profile

Actions

Bug #5901

closed

OpenBSD "[FATAL] failed to allocate memory"

Added by kernigh (George Koehler) over 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-01-16 trunk 34316) [x86_64-openbsd5.0]
Backport:
[ruby-core:42158]

Description

=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


Files

bad-patch-never-apply.diff (2.66 KB) bad-patch-never-apply.diff bad patch! do not use! kernigh (George Koehler), 01/17/2012 09:03 AM
smaller-heap-for-openbsd.diff (671 Bytes) smaller-heap-for-openbsd.diff better fix -- if OpenBSD, set HEAP_SIZE to 4 kilobytes kernigh (George Koehler), 01/17/2012 09:03 AM
smaller-heap-3.diff (887 Bytes) smaller-heap-3.diff patch by Narihiro Nakamura, but migrated to svn r34399 kernigh (George Koehler), 01/31/2012 06:27 AM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #5839: Proposal: Bitmap Marking GCClosedmatz (Yukihiro Matsumoto)01/04/2012Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0