operations on large arrays seem to crash SC

View: New views
1 Messages — Rating Filter:   Alert me  

operations on large arrays seem to crash SC

by Simon Blackmore :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I am just doing some work with really large arrays and I have hit a problem.  

SuperCollider crashes when I try to perform fairly simple operations on every item in the array.

I am probably taking the wrong approach, but it seems to work fine on small arrays...

Any advice on why this is happening and how best to do this sort of thing would be great.

Thanks in advance

Simon

Here is an example of the problem

// generate a 10 item array
a = Array(0);
for(0,10, {arg i;a = a.add((i*36)+519831);});
a.postln;

// now I want to divide every item in the array by 3 like this
q = Array(0);
for(0,10, {arg i;q = (a[0..i]/3);});
q.postln;

// thats was fine

// now lets do the same with a huge array

a = Array(0);
for(0,22188, {arg i;a = a.add((i*36)+519831);});
a.postln;

// thats fine to

// now I bet this is going to crash SC

q = Array(0);
for(0,22188, {arg i;q = (a[0..i]/3);});
q.postln;


And it did..... must be a better way.