LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leakage

I am having with a vi slowing down after several hours of operation. The application is a production motor tester. The operator starts the test by use of a push button that applies 9VDC @ .03 amps to a NI 9205. What I am experiencing is after several hours and a couple hundred tests the system becomes less responsive. At initial start up the system responds in less than a second. After several hours elapse, the operator has to press and hold the button for several seconds. At the end of an 8 hour shift the entire system is very slugish and takes 5+ minutes to exit out of the vi.

0 Kudos
Message 1 of 5
(2,309 Views)

Try the following

 

 

1. Tools-> Profile -> Performance and Memory and Show Buffer Allocation?  That may give you a hints.

2. You should check to see are the arrays stored in the shift registers growing indefinitely or not. 

3. Consider using event structure.

4. It seems to be that you are creating a lot of refernce.  It would be better if you creater a reference once and pass them on for re-use.

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 5
(2,288 Views)

Most of you shift registers containing arrays are not initialized. Unfortunately, you did not attach any subVIs (e.g. in the power case). so we cannot tell what happens to the array sizes over time.

 

And yes, you seems to be constantly creating tasks in inner loops (reverse, power), without ever closing them.

The loop inside "power" should probably be a FOR loop, because the number of iterations is fixed.

There are also a lot of race conditions. For example you are writing two different colors in parallel to be background color of voltage (Hi-POT case), How do you know which occurs first?

Way too many local variables. For example in the "POWER case" you are writing to the "hertz" terminal and reading from a local varirable of the same at the same time. Most likely, the local read occurs first, giving you a stale value. Not sure if that's what you really want, but I would eliminate the local and wire directly by branching the wire.

A lot of you code seems highly convoluted and could be simplified.

0 Kudos
Message 3 of 5
(2,278 Views)

Thanks for the pointers. I am very new to LabView and this is the first program I ever wrote. A lot of the code has been by trial and error. I guess I just need to really speed a lot of time examining the program state by state to stream line the vi.

0 Kudos
Message 4 of 5
(2,252 Views)

I have attached a zip file with the sub-vi's. I have also made a couple of the corrections you recommended. I want the loop inside the 'Power' State to repeat between the true and false states until the operator stops the test. This is due to the nature of the motors we produce. Some motors require a small amount of run in time for the readings to stabilize. This allows the motor to run and the readings to be taken until they stabilize.

 

Is there a better way to handle the data to get it from the 'Power' state to being saved in the TDMS file?

 

Thank you again for your help.

0 Kudos
Message 5 of 5
(2,215 Views)