stackoverflow problem

john one's icon

Hi there, i am currently working on a patch where it used to work fine. I then added a new part which the logic seems fine and in random time intervals stack over flow appears. So what i wanted to ask is what are the usual reasons that stack over flow occurs? Doesnt it happen when you send 2 inputs at the same time to an inlet that accepts only one? I tried to check for this and did not find anything. Also when i speed up things it occures quicker (maybe this is obvious since the process increases speed).

thank you!

john one's icon

also the main thing that was used in the new part was gswitch2 that toggles quite fast

john one's icon

also the problem occurs in different objects each time. number if statemnet switch etc....

thanx again

metamax's icon

Here's my example of stack overflow . Now you post one.

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon

"Doesnt it happen when you send 2 inputs at the same time to an inlet that accepts only one?"

it mostly occurs when you try to send 5,735 messages at once and with the order that they should reach their final aim within the same millisecond, while your CPU resources are not enough to handle this.

if a stack (a data buffer) is more than full (it has a size limit) this can easily lead to serious program errors in the runtime or in the operating system - which is why max/msp for example stops processing data when it happens.

it is kind of the opposite of "buffer underrun", which means that e.g. one max object expects to read data from a RAM buffer which is not (yet) there.

metamax's icon

You can think of stack overflow kinda like an information short circuit.

From wikipedia:
"A large current through a battery can cause the rapid buildup of heat, potentially resulting in an explosion or the release of hydrogen gas and electrolyte (an acid or a base), which can burn tissue, cause blindness or even death."

What does this mean? Well, amongst other things, it means you don't have to wear safety glasses with Max.

john one's icon

hey guys thanx for the info! i think i had misunderstood then stack overflow.
Well is there any way i could do the same with multyslider? since set$1 changes them all the same....

Max Patch
Copy patch and select New From Clipboard in Max.

thanx again!

metamax's icon

Use [prepend setlist]

In general, be sure to give the help file a glance. It's right in the messages tab.

metamax's icon

Also, use [pak] instead of [pack] if you want there to be an output every time a value changes in the list. It looks like you just need to learn more about 'hot and cold' inlets.

Max Patch
Copy patch and select New From Clipboard in Max.

john one's icon

thank metamax, u were really helpfull!