10-14-2015 07:56 AM
Hi all,
I am using LabVIEW with TestStand for a project. I have been tracing down a memory issue for a while now, and I have finally boiled it down to a single VI/While loop. My memory has been increasing consistently at about 4-5 MB/hr.
I am using a single LV UI to control all of the indicators on my system. In a nutshell, I have 32 sets of Pass and Fail indicators and a light tower. Each station writes its "State" (Pass/Fail/Error etc) into a global, which is then read by this VI. The VI then controls the indicators accordingly.
The VI is placed within a while loop in TestStand. The Global is fed into it, as well as two arrays "Green_States" & "Red_States". The two arrays are then passed out again with updated values.
What could be causing my memory usage to increase over time? My only thought is the auto indexing, but I thought I had read that auto-indexing was better for memory usage?
Attached is an LLB with the function(s) in question. The main function in the LLB is "Hardware_IndicatorControl.vi". I have also attached a screenshot of the TestStand sequence, but I do think the error is attributed to LV.
Thanks!!!!
10-14-2015 08:34 AM
10-14-2015 08:36 AM - edited 10-14-2015 08:42 AM
Hi Mike,
Thanks for the quick reply. This has never worked correctly, but if I disable this portion, the "leak" goes away. No shift registers, but I am using a for loop with the auto indexing feature.
EDIT: Missed the last part, it does not use any external modules. Just DAQmx.
10-14-2015 09:04 AM
10-14-2015 09:08 AM
Number of loop iterations are constant.
For references, I am closing all of them in the sequence. In the UI, i'm using sub panels. I write to these via a callback event from TestStand, I am not closing the reference after writing to it since I continuously write too the sub panel VI. Is this the correct way of doing this? Or should these be closed? I am closing these when the UI terminates. Check out the attached pic.
10-14-2015 10:07 AM
I'm going to guess that the problem is within the DUT Pass Indicator, DUT Fail Indicator, and Light Tower Control. A quick way to test this is to open Indicator Control and "Diagram-Disable" these three sub-VIs (thank you for using sub-VIs!). The Diagram Disable is on the Structures Palette -- draw it around the sub-VI, go to the Enable state and wire the Error Line through. When you want to get rid of it, be sure you are on the Disable state (where your original code is), right-click the structure, and choose "Remove Diagram Disable".
What I see in all three of these routines is that you do a DAQmx Start, a single Sample, and a DAQmx close. I would recommend doing all of the DAQmx Start and Close operations outside the Indicator Control While loop, bringing in the three Task wires, using them as input/outputs to the three internal VIs, and inside those VIs, just wire the Task to the DAQmx Read.
Theoretically (!!!), one should be able to open/close DAQmx Tasks without worrying about memory reclamation, but maybe that's a problem here. Test and let us know.
Bob Schor
10-14-2015 10:33 AM - edited 10-14-2015 10:35 AM
Thanks for all of the help!
Just did a little more digging, and apparently this VI is NOT the cause of the leak... I'm fairly certain that the memory issue is coming from my test sequence in TS. Now to track that down.....
I had tried passing in the reference and keeping the task open, but that didnt seem to make any difference.
10-14-2015 10:45 AM - edited 10-14-2015 10:49 AM
Ok, so I here's another set of VI's if you kind folks could look at.
I call the "Steps_GetPSUStatus" VI in a loop every 0.5s or so. I open the reference to the PSU before the loop and close it once its finished, as recommended by Bob_Schor. The clusters are passed in and passed out to TS.
Is there anything about this set of VI's that may cause an issue? Maybe my use of VISA functions is incorrect?
10-14-2015 11:10 AM
Just a guess here, as I cannot find the reference, but move your controls & indicators outside of the case structure. I rememeber reading somewhere if the controls & indicators are outside of the case structure data buffers can be reused.
Cheers,
mcduff