LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is this SubVI taking longer each time I run it?

Solved!
Go to solution

I am running this SubVI inside a For loop, with say 2000 iterations. As the iterations increase, I notice the elapsed time increasing, starting around 15ms when i=0 and inching up continuously until it is around 100ms at i=2000.

 

Let us accept that there is a method to my madness and not get bogged down in why I want to turn this on and off 2000 times. I have a similar subvi in the same loop, which does some waveform in/out tasks, that is showing the same problem on a larger scale. I am noticing a memory leak when I look at the Windows Task manager as well.

 

I suppose that creating the Voltage task every time is the problem, and I can certainly go move it to before the loop. But I don't understand where the lost time is going. Does it have to do with how Labview stores/accesses tasks maybe?

 

 

increasing elapsed time.png

0 Kudos
Message 1 of 4
(2,598 Views)
Solution
Accepted by topic author fborlc

My guess?  You're creating a new task every time but not closing it, so you end up using all the resources on your computer.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 4
(2,581 Views)

I don't think the issue is that the task is not being closed, because this other subVI, attached, does close the tasks but exhibits the same problem

0 Kudos
Message 3 of 4
(2,577 Views)

Welp, nevermind -- seems like the unclosed task in one was causing the problem in the other.

0 Kudos
Message 4 of 4
(2,570 Views)