mje Posted July 20, 2012 Report Share Posted July 20, 2012 So if I have a VI call configured to "Reload for each call" via the VI Call Configuration dialog, does it actually do any load/unload if the VI is part of a class? The VI is part of a library which means its already loaded, correct? Is there any actual loading and unloading going on? Quote Link to comment
Darren Posted July 20, 2012 Report Share Posted July 20, 2012 I don't think so. If something else is keeping that VI in memory (in this case, it would be the fact that it's owned by a class), then I'm pretty sure that setting isn't doing anything....well, assuming your class is in memory the whole time. Quote Link to comment
mje Posted July 20, 2012 Author Report Share Posted July 20, 2012 Hmm, quick and dirty test attached (LV 2011 SP1). Reload.zip It seems regardless of a VI being in a class or not, it is actually loaded and unloaded on each call when in the RTE. If you look at the attachment there's an exectuable, re-build it from the included project if you don't trust it. When running the executable, each time you click the "Dynamic Class Call", the application will make a call to a class method set to load and unload each time. Ditto for the other button, but the called VI is not part of a class. When you click one of the buttons, the corresponding method will initialize an array of bytes to the size you specify and store it locally in a feedback node, returning the number of bytes that were previously stored. Each time you click either button, the array size that was previously stored will always return zero, indicating the VI is successfully being unloaded each time. Checking the windows task manager confirms, the memory required stays low, though the peak memory goes up. This all goes out the window if you have a static call to the VI somewhere in the code. Follow up, nevermind. I didn't realize LabVIEW would be smart enough to discard the entire class library if it is no longer needed. Throw some instance of the class on the test.vi diagram somewhere and the class method always sticks around. Quote Link to comment
GregR Posted July 20, 2012 Report Share Posted July 20, 2012 If the VI is preallocated reentrant, then you should be allocating and deallocating a clone each time even if the VI itself is staying in memory because of other references. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.