Why Do I Get Stack Overflow When I Have A Condition That Is Guaranteed to Solve Itself?


    Jul 15 2008 | 6:58 pm
    I am trying to build a midi note range limiter, but get a senseless stack overflow message. Here is what my patcher logic looks like:
    now, if you remove the patchcord running from the [+12] object back to the [ < ] object, it runs fine. See, eventually the patch will solve itself, because if you add 12 enough times, you'll eventually get a value higher than what's given as the bottom note value. Why then will Max not allow this?

    • Jul 15 2008 | 8:10 pm
      There's no way for a patch to "know" that it will solve itself.
      Perhaps another look at the paragraph "The Trouble With Loops" in Max Tutorial 5 might help to refresh your memory as to why loops are bad things.
    • Jul 15 2008 | 8:14 pm
      You might also benefit from the split object.
    • Jul 16 2008 | 9:24 pm
      or zmap?
      Gregory Taylor wrote: > You might also benefit from the split object. > -- > knowledge is not enough/science is not enough/Love is dreaming this equation > > >
    • Jul 17 2008 | 9:03 am
      Note that Max has a finite amount of memory to work with.
      If your patch has a feedback loop, Max (or any program) has basically two options: (1) interrupt processing before the stack overwrites some other area of memory or (2) crash.
      By and large, the former of the two options is considered preferable.
      There are a zillion other ways to implement what you're trying to do without eating up ridiculous amounts of memory.