LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging memory leak

I'm having an issue where my Labview program is eating tons of memory and not releasing it even after I hit stop. So now my program is using 660,092 k stopped. After I hit run it just continue to increment. I have 2 queues and the # items in the queue is at 0. I check my main arrays which I'm processing and sizes of those are not growing. Is there a good way to look at all the variables which my program is using and figure out which one is causing the issue? My program didn't do this until I attempt to streamline some the calculations.

 

Thanks.

Message Edited by d1sturbanc3 on 08-26-2008 11:35 AM
Message Edited by d1sturbanc3 on 08-26-2008 11:37 AM
0 Kudos
Message 1 of 9
(4,101 Views)

Are you using any Local Variables or Property Nodes?  Especially for your array(s).

Do you close the Queue reference at the end of the program? (unlikely source of problem)

 

Do you open any reference (ie file, controls, DAQ, etc) that are not closed?

 

If possible, please post your code so that people within the forum can have a look at it.

 

R

0 Kudos
Message 2 of 9
(4,093 Views)
Yea I'm using a lot local variables and a property nodes. There are several queues. It's quite a complex program I've written with about 5 while loops with about 270 VIs and controlls. I'm disabling subsection and seeing if that causes it, but it's annoying. I don't think you want me to post my code since it's that complex. I just didn't know if there were any tricks to doing it.
Message Edited by d1sturbanc3 on 08-26-2008 11:54 AM
Message Edited by d1sturbanc3 on 08-26-2008 11:56 AM
0 Kudos
Message 3 of 9
(4,091 Views)

You should use an architecture which minimizes the use of property nodes (if they are used to pass data) and eliminate the use of Locals as much as possible.  Why are you using 5 while loops?

 

Are you familiar with Event Structures and State Machines?

 

R

0 Kudos
Message 4 of 9
(4,077 Views)

Yep.. I have 1 DAQ process. 3 Process that will write to 3 different files logging each with their own buffer and their own drives.

1 timing control look which pass user controls to the DAQ/computation based on the current time.

 

1 Data processing while loop which does about 20+ FFTs with multiple stats analysis per segment of DAQ.

 

How much memory do property nodes leak anyway? There isn't really a way I can get around not using property nodes since I have a good number of graphs to display.

Message Edited by d1sturbanc3 on 08-26-2008 01:18 PM
Message Edited by d1sturbanc3 on 08-26-2008 01:19 PM
0 Kudos
Message 5 of 9
(4,060 Views)

Oh..  you're using graphs... I knew I should have included that to the list... 😉

 

It's not that property nodes leak memory...   hummm... how to explain it...

 

Here's a thread that describes it in better words than I would (in a short time):  http://forums.ni.com/ni/board/message?board.id=170&message.id=126834&query.id=29852#M126834

 

Pay attention to what Rolfk mentions about using Property nodes in a loop to pass values.

 

You may be able to accomplish the same by simplifying the code and reducing the number of while loops to 2 or 3 (max).  There are tricks you can do using dynamic VI's (deamons) for your DAQ process and using a consumer loop for your FFT's.  I'd have to see the code to better suggest alternative solutions..  However, direct wiring is the best way to go.   And with a State Machine, you can use Shift Registers to pass the data to other states.  You can also use Shift Registers to update values within the same loop / same state..

 

R

0 Kudos
Message 6 of 9
(4,046 Views)
0 Kudos
Message 7 of 9
(4,044 Views)

oh the update issue with property node. I solved that by making my own update scheme. I have a flag that if data change, the VI that calls update through the property node. This way the only time the propery nodes gets update is when the value changes from the computations.

 

In another words I solved that by controlling when to update the graph based on property nodes by detecting actual changes in the data. If there are no change, the property nodes do not get updated.

 

My current problem isn't that the program is using too much memory, it's that the memory usage isn't stopping. In C/C++ debuggers, I usualy have a table that will show me all the variables along with the memory of all the variables is shown. This way during a memory leak, I can see which variable is growing and not stoping and be able to track it down. Is there such a functionality for labview?

Message Edited by d1sturbanc3 on 08-26-2008 01:51 PM
0 Kudos
Message 8 of 9
(4,043 Views)

You can use the Profile window to display data about the execution time and memory usage of VIs. 

From the Tools Menu, select Profile > Performance & Memory...

 

R

 

Message Edited by JoeLabView on 08-27-2008 12:26 PM
0 Kudos
Message 9 of 9
(4,000 Views)