01-26-2010 11:12 AM
I have a VI that slows to a crawl after being run continously for 48 hours. It is just a basic data aquistion program that I need to run for two weeks. Any thoughts would be greatly appreciated.
Solved! Go to Solution.
01-26-2010 11:24 AM
You are building arrays inside the loop. As they grow LV needs to continually reallocate memory. Arrays require contiguous memory blocks. When the arrays get too large, the OS may start swapping to disk and then things really slow down.
After you write the data to the file, clear the arrays.
Better is to preallocate space for the arrays and use Replace Array Subset inside the loop.
01-26-2010 11:25 AM
You are building three complicated arrays with no upper size limit and you will run out of memory. Every time the array grows, memory needs to be reallocated. These near infinite sized arrays are the graphed, also not a fast process.
Most likely your noticing a slowdown once the OS starts swapping.
Why don't you use a charts with limited histories and stream the data to disk for later retrieval?
01-26-2010 01:07 PM
Thanks that definately makes sense. I'm still learning my way around labview and don't really know how to do this. How do I limit the size of an array ? How do I limit the history size in a chart so that I don't end up in a swapping situation ? Are there any examples of something like this around ?
01-26-2010 01:13 PM
How do I limit the history size in a chart so that I don't end up in a swapping situation ?
A chart has a built-in history buffer. The default size is 1024 samples but you can configure it with a "right-click... chart history lenght"
01-26-2010 01:53 PM
Thanks! Hopefully this won't slow down now.
01-27-2010 02:42 PM
Ok so I've got a chart now and it isn't chewing up a ridiculous ammount of memory !!
THe problem I am having now is that the initial time on the charts is 19:00:00 2003/12/31. How do I initialize the chart time so that it is the current time and not new years eve in 2003 ??
01-27-2010 03:26 PM
That is actually December 31, 1903 at 6 pm. You must be in the central time zone.
You need to take the current time before your while loop starts and wire it to the XScale.Offset property node for each of your charts. Also set the XScale.Multiplier to be the value you have in the control going into the time delay function.
01-28-2010 08:03 AM