[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Maximum stack depth of sc lang?

The maximum stack depth for recursion in SC seems to 
be somewhere above 256 - as I could figure out by the
simple code below. (Did not look for it in the source 
code as it would take too much time for me). 

Is this documented somewhere.  If not, it would be great
if someone could add it to the help files. 

Iannis Zannos

r = { arg stackdepth = 10, counter = 0;
	if (counter < stackdepth, {
		r.value(stackdepth, counter + 1);
/// execute these 1 at a time till you crash or get memory error: 
l = List.new; r.value(10).size;
l = List.new; r.value(100).size;
l = List.new; r.value(200).size;
l = List.new; r.value(250).size;
l = List.new; r.value(256).size;
// somewhere above 256, maximum stack-depth is reached
l = List.new; r.value(259).size;
l = List.new; r.value(270).size;
l = List.new; r.value(290).size;
l = List.new; r.value(299).size;
l = List.new; r.value(300).size;
l = List.new; r.value(301).size;
l = List.new; r.value(350).size;