...well, for future reference, Invalid memory access (signal 11) at address 0x7ff7b19429f8 likely means the application has overrun its stack, especially if the stack trace shows even moderate recursion.

about the recursion though, this error happened after only 5 recursive calls (not 50,000) and that caught me off guard. i've been recently conditioned to think the stack only holds primitive values and references (pointers) but crystal, like c and similar languages, lets you pass around structures (instances of struct) by value and those values can be arbitrarily large.

now i need to figure out how to debug the contents of the stack...

#crystallang

@toddsundsted I'm very curious as how you hit the stack that badly. If it's a legitimate use, likely you could enlarge the stack

· Edited · · · ·

@beta i'm curious, as well. i've temporarily increased my stack size so that i can finish what i'm working on, but that's not a solution i'd like to have to ship. it happens in the same place in linux and osx, and with different versions of the language, but so far it only happens when i run tests, so it is possible the testing framework is somehow setting things up in a way that triggers it, but that being the solution requires more faith than i have. i can also easily rewrite this code to be iterative instead of recursive, but that feels a bit like giving up too early. i'll definitely pass along anything i find that might be useful! thanks for inquiring!

A Mastodon instance for programming language theorists and mathematicians. Or just anyone who wants to hang out.