Is there a limit on arrays?
I want to store clip names provided via OCS messages in an array. Those message are usually sent on deck change in the OSC Host (Resolume) - so they appear bulky. Lemur crashes very often on deck change, could this be caused by some array limits, race conditions?, etc.?
Also sometimes it seems that the array get corrupted, meaning the Monitor object (which monitors and displays the array) shows strange characters and different colors. Then Lemur crashes.
Any ideas?
Lemur crashes --> Limit on array size?
-
- Liine Staff
- Posts: 126
- Joined: 14 Dec 2011 12:12
Re: Lemur crashes --> Limit on array size?
Arrays are limited to 256 items. Any crash is a bug however, so please post your template so we can give it a look.
Re: Lemur crashes --> Limit on array size?
hi I was just fighting with Lemur crashing this morning due to array handling in scripting. frustrating, but keep at it!
There seem to be some memory handling bugs related to array length growing and shrinking with reassign and possibly some problems with the subarray function bounds checking.
My basic workarounds are:
1) ensure arrays are initialized to the full number of items that your code will use "on load". Use the split or fill function:
myarray=split(0,100);
or myarray=fill(0,0,100);
This morning doing this to all my arrays that were greater than 40 bytes in size allowed my template (it was at 500k or so) to continue to run. It was crashing every time that array was partially filled prior to that.
2) always ensure that the array size is within the limits of what you attempt to extract from it.
So myarray={5,2,12,4,4,5} That gives an array length of 6.
Somewhere later in time in the template, that array may be grown or shrunk.
like myarray={6,5,3,1} which changes the size.
Try not to extract a greater number of elements than actually exists or begin at an offset/start that is out of current array size.
So bounds check:
if(sizeof(myarray)>3) mynew=subarray(myarray,1,3);
or to assign a higher index of 3 values from myarray
if(sizeof(myarray)>7) mynew=subarray(myarray,5,3);
3) Do not fill an array with too much information. Right now as Axel states there is the limit of 256 items, but each item can vary in size if it is a text item. myarray={'test 1','test 2 element 1','t','message',1,2,1}
Not sure what the total bytes all of the combined array element can be.. Anyone?
hope this helps and maybe even sheds some light on the subject!
-Jay
There seem to be some memory handling bugs related to array length growing and shrinking with reassign and possibly some problems with the subarray function bounds checking.
My basic workarounds are:
1) ensure arrays are initialized to the full number of items that your code will use "on load". Use the split or fill function:
myarray=split(0,100);
or myarray=fill(0,0,100);
This morning doing this to all my arrays that were greater than 40 bytes in size allowed my template (it was at 500k or so) to continue to run. It was crashing every time that array was partially filled prior to that.
2) always ensure that the array size is within the limits of what you attempt to extract from it.
So myarray={5,2,12,4,4,5} That gives an array length of 6.
Somewhere later in time in the template, that array may be grown or shrunk.
like myarray={6,5,3,1} which changes the size.
Try not to extract a greater number of elements than actually exists or begin at an offset/start that is out of current array size.
So bounds check:
if(sizeof(myarray)>3) mynew=subarray(myarray,1,3);
or to assign a higher index of 3 values from myarray
if(sizeof(myarray)>7) mynew=subarray(myarray,5,3);
3) Do not fill an array with too much information. Right now as Axel states there is the limit of 256 items, but each item can vary in size if it is a text item. myarray={'test 1','test 2 element 1','t','message',1,2,1}
Not sure what the total bytes all of the combined array element can be.. Anyone?
hope this helps and maybe even sheds some light on the subject!
-Jay
filmriss wrote:Is there a limit on arrays?
I want to store clip names provided via OCS messages in an array. Those message are usually sent on deck change in the OSC Host (Resolume) - so they appear bulky. Lemur crashes very often on deck change, could this be caused by some array limits, race conditions?, etc.?
Also sometimes it seems that the array get corrupted, meaning the Monitor object (which monitors and displays the array) shows strange characters and different colors. Then Lemur crashes.
Any ideas?
Dashboard gear control templates: User 112 Idx :: LModIt Lite :: SVG image converter for Lemur Canvas