03-04-2019 10:14 AM
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?
03-04-2019 10:20 AM
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
03-04-2019 10:34 AM - edited 03-04-2019 10:44 AM
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?
03-04-2019 10:46 AM
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
03-04-2019 11:13 AM
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.