LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
lvABC

Unload All Modules – Menu item option

Status: Declined
There are technical limitations preventing a LabVIEW class from being unloaded once it is loaded. More details in AristosQueue's post here: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Unload-All-Modules-Menu-item-option/idc-p/2853828#M277...

I like LabVIEW to add “Unload All Modules” menu item that will unload any library that User has loaded during the LabVIEW development session.
The Modules can be LVOOP, dll, .net dll, ect.

 

-lvABC

9 Comments
wiebe@CARYA
Knight of NI

For classes, I think a class is in memory when used in a project or VI in memory. When all projects and VI's that use it are closed, the class is removed from memory. An "Unload All modules" won't be able to unload a module if it's used, and if the module can be unloaded, it will be unloaded automacally..

 

Some goes for (.net dll's). A dll is unloaded when nothing refers to it. When something is refering to it, it can't be unloaded.

 

In short, LabVIEW already unloads everything it can when possible.

 

Perhaps I am wrong, this is shady stuff. Can you describe a use case?

lvABC
Member

@wiebe@CARYA

In Windows OS platform LabVIEW doesn’t release any handle that acquire to load dll or .net dll upon closing VI or Projects.
It will only release when LabVIEW shutdown.

At least to my knowledge and I can see them on Resource Monitor.

-lvABC

wiebe@CARYA
Knight of NI
i`ve workd a lot with dll`s, and I`m pretty sure LabVIEW unloads them. It could be Windows that cches them. Opening LV in a debugger cn make this conclusive. But don`t look at the code, that i illegal in some countries. I used to do this al the time: Compile a C dll, test it in vi, this will block compilation. So I delete the dll from the diagram, and then I can recompile dll. You can also ue the external path to specify the dll to load. If you specify a new path, the ld dll is unloaded.
wiebe@CARYA
Knight of NI
Sorry for the lack of formatting in thee posts. The Android web interface removes all new lines for some reason.
PNR
Member
Member

This is a very interesting idea. In my own experience, (most) common DLL files unload only if you close LabVIEW. .NET Libraries and LVOOP classes are generally unloaded if you close the project (no need to close LabVIEW afaik). Now I have no clue how LabVIEW implements all the loading/unloading of external resources, but it should be possible to unload while the project is opened (and it would save a ton of time). The option to unload LVOOP instances should be possible at least (Maybe an option on Items in Memory?).

 

I see but one big problem:

LabVIEW must load the DLL or .NET library in order to provide the functions/methods/properties list we could select either on the call library node or with the invoke/properties nodes, so unloading them would cause the caller VIs to render with a broken arrow...

And there might be many more implications.

wiebe@CARYA
Knight of NI

Turns out you are right about the dll unloading. It doesn't happen anymore. It used to, I've tested LV7.1, and there it still unloads when all instances are removed. So much for progress...

 

You (both) did not present any use cases. Do you need this for dll development, of do you have memory concerns? Or something else?

 

I like the idea, but wouldn't it be better if it was done automatically?

 

Btw I've tested this with a dll,  that pop's up a messagebox on DLL_PROCESS_ATTACH , DLL_PROCESS_DETACH, DLL_THREAD_ATTACH, DLL_THREAD_DETACH and when HelloWorld is called (no parameters). I'd post it, but I can't seem to attach anything.

PNR
Member
Member

You are right, the use case is dll development. In my case development of wrapper dlls which are under heavy development with quick changes for quite some time untill they get stable. When it comes to LVOOP classes, I'm speaking about plug-in architectures where the plug-ins should be unloaded (this idea actually gives a better approach to LVOOP and has been posted short after this one: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-user-to-unload-a-class-from-memory-programmatica...).

AristosQueue (NI)
NI Employee (retired)

There are technical limitations preventing a LabVIEW class from being unloaded once it is loaded. Short story: It would require the ability to track all instances of the class in memory and such tracking imposes a severe performance penalty that hampers execution of classes everywhere. This is a limitation imposed by most other programming languages that support dynamic type loading for similar reasons. For details: https://decibel.ni.com/content/docs/DOC-13724#comment-14806

Darren
Proven Zealot
Status changed to: Declined
There are technical limitations preventing a LabVIEW class from being unloaded once it is loaded. More details in AristosQueue's post here: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Unload-All-Modules-Menu-item-option/idc-p/2853828#M277...