-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yukihiro Matsumoto wrote:
> Did SystemStackError happened during rb_define_module_function()?

No, it happened later, when the Ruby interpreter was executing a script.

> What OS are you using?

Linux 2.6.12-10-386 #1 Mon Jan 16 17:18:08 UTC 2006 i686 GNU/Linux

> Since you are using embedded Ruby, you may fail to call Init_stack()
> in the interpreter initialization.

Ah, thank you. I tried putting a call to Init_stack() in my
initialization code but no luck. However, the problem is neither
with embedded Ruby nor with my initialization of the Ruby interpreter:

After some more investigation I happened upon the answer. There was
indeed a heap/stack limitation upon the Ruby interpreter embedded in
my C program!

(my C program, inside its own process
 .. unlimited stack space ..

  (Ruby interpreter, inside a pthread
   .. 2 MiB of stack space ..

  )
)

I was using the pthread library, with default attribute values
(thread stack size = 2 MiB) for pthread_create(), to launch the Ruby
interpreter. Naturally, the interpreter eventually ran out of stack
space and produced the SystemStackError.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFD+MOcmV9O7RYnKMcRAleEAJ4yC3X0OFEoEolyEsv1YNObj0MDBgCfSiJA
sVF/m8hSVv9ZhEmlzwxamVE=
=bVQ+
-----END PGP SIGNATURE-----