We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This code:
require "big_int" def fib(n) n > 1 ? n * fib(n - 1) : n end fib(100_000.to_big_i)
Just gives a segfault. Reducing the value to 1000 solves. Compiling it with -d and running in gdb gives:
1000
-d
Starting program: /tmp/test [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7ffff3649700 (LWP 3833)] [New Thread 0x7ffff3e4a700 (LWP 3832)] [New Thread 0x7ffff464b700 (LWP 3831)] [New Thread 0x7ffff4e4c700 (LWP 3830)] [New Thread 0x7ffff564d700 (LWP 3829)] [New Thread 0x7ffff5e4e700 (LWP 3828)] [New Thread 0x7ffff664f700 (LWP 3827)] Program received signal SIGSEGV, Segmentation fault. 0x0000000000401991 in __crystal_realloc ()
Not very useful. Running on valgrind gives a LOT of messages related with GC_* functions and this one, which may be the cause of segfault:
GC_*
==3255== Stack overflow in thread 1: can't grow stack to 0xffe801c48
So I think Crystal isn't checking if it can allocate more memory on the stack. The same code on ruby gives:
test.cr:4:in `fib': stack level too deep (SystemStackError)
The text was updated successfully, but these errors were encountered:
This is essentially a duplicate of #271
Sorry, something went wrong.
Hum, sorry about that. I should have looked before posting. Closing it now, thanks!
No branches or pull requests
This code:
Just gives a segfault. Reducing the value to
1000
solves. Compiling it with-d
and running in gdb gives:Not very useful. Running on valgrind gives a LOT of messages related with
GC_*
functions and this one, which may be the cause of segfault:So I think Crystal isn't checking if it can allocate more memory on the stack. The same code on ruby gives:
The text was updated successfully, but these errors were encountered: