LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Will creating a large array of strings ever cause problems?

I have a test that can run continuously for a week or more. It displays data as strings about once a minute in a table indicator. So up to a max size of maybe a 20x10,000. As this array grows large, are there any potential memory issues (or other problems) that I need to worry about? The rest of my application is not very memory or processor intensive.

 

Also as a more general programming practice question, should I be preallocating and using in place structures to add data, or will Labview be smart enough under the hood that concatenating elements to the array won't cause problems?

0 Kudos
Message 1 of 5
(2,685 Views)

Arrays have to be contiguous so as your array grows it will have to allocate more mmeory each time it exceeds the previously allocated size.

 

Tools >>> Profile >>> Profile buffer allocations

 

May be helpful.

 

Now if you are saying that you will have 10,000 strings each being 20 bytes long, that is trivial.

 

LV is wicked smart these days with allocating memory and it seldom requires any help on from us. Back in LV 6i, that story was different.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 5
(2,683 Views)

Thanks, that looks like a helpful tool. I'll have to take a look at it more.

 

Any rough estimate of the size an array needs to be before it starts causing issues? I'm also guessing that for RT applications, it becomes more important to take some control over memory allocation of arrays?

0 Kudos
Message 3 of 5
(2,674 Views)

RT is a different story.

 

Memory usage under RT should quickly peak and then either level off or drop. It should NEVER go up (unless you want it to crash ).

 

RT is also subject to jitter if memory buffer have to be reallocated.

 

Generally speaking strings are dangerous ( or can be if you are not careful) under RT> If memory serves me, the RT FIFOs intended for use under RT do not even support strings.

 

I have seen application that used a text file as a "recipe" crash under RT if the text file was too large.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 5
(2,658 Views)

The main drag will probably be with redrawing that gigantic table indicator, i.e. you are taxing the UI thread. You'll have three copies of that data (in the wire, in the transfer buffer, in the indicator).

 

With RT, there is no front panel, so it is a matter of what and how you transfer the data to the code running on the PC.

Message 5 of 5
(2,642 Views)