11-17-2011 04:18 PM
I have a complicated application; the main VI spawns VI_a and then VI_a spawns VI_b. I use the Open VI Reference function along with the Run VI method in an Invoke Node to spawn the VIs. VI_b adds and destroys x number of shared variables. see enclosed subVIs.
When it is time to quit the application, the main VI sends commands via Queues and global variables to VI_a, who then sends commands via Queues, global variables, and functional global variables to VI_b.
Just before VI_b quits, it sets a functional global variable to notify VI_a that it is quitting. Finally it sets its FP.Open property to FALSE. This affectively quits the VI.
Once VI_a knows VI_b has quit, it finishes its quitting process. The next to the last step is to set a global variable to notify the main VI that it is quitting. Finally it sets its FP.Open property to FALSE. This affectively quits the VI.
Once the main VI knows VI_a has quit, it finishes its quitting process. Its final step is to set its FP.Open property to FALSE. This affectively quits the VI.
Now the problem. LabVIEW is still running using at least 50% of the CPU. In Project Explorer the cursor is an hour glass. When LabVIEW stops hogging the CPU, the cursor returns to the selection arrow. When LabVIEW releases CPU usage, it does so very quickly.
How can I diagnosis what LabVIEW is doing when all the front panels of the VIs are closed and therefore should not be running? I've tried using the Profile tool but have not been able to capture anything. I have noticed that the more shared variables active at quitting time, the longer it takes LabVIEW to release the CPU. I'm using LabVIEW 2011.
Solved! Go to Solution.
11-18-2011 11:49 AM
to help explain what I'm doing, I've enclosed some screen shots
11-18-2011 02:00 PM
Hi Faustina,
It's not enough to use the FP.Close function to remove these SubVIs from memory; you also need to use the Close Reference function. You can use the Close Reference function before or after you open your Sub VIs; this document explains some of the details of that process. Also, it would be better practice to actually stop all of the processes that are occurring within your sub VIs, to ensure that you don't leave any references open when you close them. Functional Global variables do not leave memory until the VI that originally calls them leaves memory also, so it would make sense that the more globals you have loaded, the more memory your application consumes. Are you using VI profiler (Tools>>Profile>>Performance and Memory) to monitor your VIs?
Best,
Dan N
Applications Engineer
National Instruments