LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register limitations

I am using a shift register in a while loop to build an array(cluster(float x, float y)). This while loop pulls down a trace from a network analyzer which I average. I then take the average and cluster it with the time so that I can display the array of measurements against time. The trace is downloaded about once / sec and left to run overnight. The vi then freezes. No error messages just stops and the red abort light is still on. When I switch to the diagram and hit highlight execution there is no sign of life or death.

I ran this same vi without a cluster just the average array(float y)into a chart of size 200K and it ran fine over the weekend. Now that I have switched to a cluster array it stops after several hours (~18,000 points)of running. Both times its done this it stopped at 17:15. Should I be allocating memory for this vi?
Could it be a virus checker or some timmed occurance is causing this to freeze?

TIA

Norm
0 Kudos
Message 1 of 2
(3,487 Views)
Most likely you are running into memory allocation problems. In general it is better to avoid building an array in a loop for that reason. If you know how big the array is going to be (or have an upper limit on the size) initialize an array of that size outside the loop and use Replace Array Subset (or element) inside the loop to put the data into the array. This does not change the size of the array and does not create extra copies in memory.

Use the profiler to watch your memory requirements. If the memory is growing, you need to find out where and fix it. There is a lot of information on efficient use of memory in the manuals and help files.

Consider writing the data to a file and clearing the buffer (shift register). This does not eliminate the memory leak but may prevent it from killing your program. It also protects the data in the event of a power failure or other problem with the computer.

Other things to look for include references (VISA, queues, etc.)which are created but not disposed, other programs or processes running in the background, numeric overflow (an integer counting past the maximum value for the datatype usually does not cause crashes, but it is something to check). On long term data acquisiton projects it is usually wise to disable all other programs and disconnect from networks, if possible. The virus checker or the OS checking for a software update can be very disruptive.

Writing the error cluster and other status indicators to a file from time-to-time can also be helpful in troubleshooting.

Lynn
Message 2 of 2
(3,461 Views)