Skip to content
New issue

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

Stack overflow when evaluating factorial #174

Open
Sabine-Schnabeltier opened this issue Sep 27, 2023 · 2 comments
Open

Stack overflow when evaluating factorial #174

Sabine-Schnabeltier opened this issue Sep 27, 2023 · 2 comments

Comments

@Sabine-Schnabeltier
Copy link

Evaluating 15000 factorial crashes TruffleSqueak with:
Resource exhausted: Stack overflow

This happens even when starting with an expanded stack:
./trufflesqueak --vm.Xss128m
./trufflesqueak --vm.Xss1024m

@Sabine-Schnabeltier
Copy link
Author

Verified this problem on Intel and Apple Silicon Macs and on native and JVM Intel Linux.

@fniephaus
Copy link
Member

It seems that running factorial in the interpreter overflows the stack completely, due to its recursive nature. I tried to use different values and couldn't get it to work either. I will take another look when I have some time. Interestingly though, 15000 factorial runs fine when it is JIT-compiled. You can try this:

1500 factorial.  "evaluate in workspace and then wait a few seconds for the JIT to compile #factorial"
15000 factorial. "evaluate in workspace and it works fine"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants