Hi David,
Funny, I just posted a good example of stack overflow, the typical counter:
[f]X[+ 1]
where [+ 1] gets sent to the hot rather than the cold inlet of [f].
Because computers are dumb animals, they will try to do exactly what you tell them to without any regards to whether it's sane/possible or not. In this case, the classic stack overflow, you've asked the computer to put itself in an infinite loop ("infinite recursion"), counting and retriggering itself as fast as the CPU will let it do. When PD detects this, it disables that part of the patch and gives a "stack overflow" error.
Sending a "bang" message to the [until] object, created without an argument saying how many times the bang should be done, will give roughly the same effect--effectively you have said to do something forever without limit and with no time constraint (although this particular example does something worse than just throw a "stack overflow" message, it completely freezes PD!).
For a proper explanation, Wikipedia offers the following:
http://en.wikipedia.org/wiki/Stack_overflow
The gist of it is, you have used up all the available memory in the call stack, and the program has no more memory to store variables and do operations.
Avoiding stack overflow is possible by practicing good patching strategies and paying close attention to order of operations. Use [trigger] to properly sequence messages. Don't "fan" patch cables, which can create indeterminate order of operations. Pay attention to "hot" and "cold" inlets, so that a section of the patch can't run away with itself (as in the improper counter example above). Use the "Find last error" command to try to sniff out where the overflow might be happening, then look for fanned cables, wrong connections or other indeterminate/not sane orders of operations there.
Hope that helps, d.
David Schaffer wrote:
Can anyone explain me what a "stack overflow" error is (at least what it means in Pd) and what I can do about it?! Thank you