LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab controls eating up CPU time

A coworker created the section of code in the attached example to change the colors of each tab page in a tab control. Originally, he had this portion of code inside a while loop. We found that as the application ran it would use more and more CPU time until the CPU load was at 100% (it would start around 1-2%); the time for the increase was a few minutes. Moving this code outside of the while loop completely fixed this problem.

Question: why would setting a tab control color in a while loop cause this increase?

Platform: LabVIEW 6.1 on Windows 2000.
0 Kudos
Message 1 of 3
(2,749 Views)
This is likely due to the fact that the color changes were each being done individually, which forces a redraw each time. A method to use to avoid this is to hold all front panel updates until the end.

You should be able to find some documentation on how to do this on NI's website. However, it should be a fairly simple application of properties or methods under the VI.
Message 2 of 3
(2,749 Views)
This behavior is caused by the repeated creation of page references inside the loop. When you move the Page property node outside the loop you don't see this memory leek.
The reason for this is that each time the loop executes the property node creates a new set of references. Since these references are always the same, it is best to have this code outside the loop and only get the page references once.

Zvezdana S.
National Instruments
0 Kudos
Message 3 of 3
(2,749 Views)