From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Slowing to a crawl

Solved!
Go to solution

Hi,

 

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.

 

Thanks

0 Kudos
Message 1 of 9
(3,191 Views)

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.

 

Lynn 

0 Kudos
Message 2 of 9
(3,189 Views)

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? 

0 Kudos
Message 3 of 9
(3,188 Views)

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 ? 

0 Kudos
Message 4 of 9
(3,154 Views)

ryano wrote:

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"

Message 5 of 9
(3,148 Views)

Thanks! Hopefully this won't slow down now.

 

 

0 Kudos
Message 6 of 9
(3,132 Views)

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 ??

0 Kudos
Message 7 of 9
(3,108 Views)
Solution
Accepted by topic author ryano

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.

Message 8 of 9
(3,095 Views)
Thanks Ravens Fan for all of your help !!
0 Kudos
Message 9 of 9
(3,065 Views)