OpenBSD AMD64 NoMemoryError - bug?

Hi all,

I'm encountering an odd error, but only on the amd64 using OpenBSD. I
believe I've boiled it down to the attached test case. Here's an
example run on 2 systems I have:

First on CentOS 4.2 x86 with 1GB of RAM:

    $ ./obsd-amd64-membug.rb
    Allocating a big array of strings of length 300.
    We've done enough:
        Array size = 1789570
        Estimated memory size = ruby + 512.00008392334 MB

Good, it does the right thing. Next on AMD64 OpenBSD 3.7 with 1GB of RAM:

    % ./obsd-amd64-membug.rb
    Allocating a big array of strings of length 300.
    Caught exception
            Array size = 126103
    [FATAL] failed to allocate memory

Hmm... odd it failed to allocate memory on a 'puts'. Very strange. Now
if we alter the script slightly, just remove the '\t' from lines 27 and 28
in the rescue block we get:

   % ./obsd-amd64-membug.rb
   Allocating a big array of strings of length 300.
   Caught exception
   Array size = 126103
   Estimated memory size = ruby + 36.0783576965332 MB

   ./obsd-amd64-membug.rb:13:in `initialize_copy'
   ./obsd-amd64-membug.rb:13
    1) Caught exception failed to allocate memory
    2) Caught exception NoMemoryError
     
I seemed to remember several times in the past year where there have
been whitespace issues in a script that caused odd bugs, but I was
unable to find them.

Anyone have a clue?

enjoy,

-jeremy

obsd-amd64-membug.rb (1.04 KB)

···

--

Jeremy Hinegardner jeremy@hinegardner.org