From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory leak when using a Labview DLL in VC++

Hello all !

 

I currently developping a module based on FPGA (NI 9146), doing some special signals processing, written in LV FPGA (2013).

This module is considered as a simple device of an industrial machine, managed by CNC, PLC and supervised by a PC. The main PC software is developped in VC++ 2008.

The module works alone and just need some orders from the PC : "Start", "Stop", "Parameter". To do the interface, I simply made the 3 VI corresponding, then build a DLL from them.

In VC++ , I simply use the function "LoadLibrary" and "FreeLibrary" to be able to access the functions. And it works perfectly.

 

But, for some reasons (due to another software we don't have the hand on), we must free the library just after using the function we need. That means once a minute, I load the DLL, use the function "Parameter" and free the DLL. For me, it's normally not a pb. (even if I would prefer to load the DLL only once, like I would do in other cases)

 

The problem is that, after each time the DLL is loaded/unloaded, the amount of memory allocated by the main app is more than before, about 100K... After a while, you easilly understand what happen, application crashes...

 

I did so far a lot of experimentations, and try to simplify as much as possible to understand what is wrong. Now, I have a very simple  VC++ application on my computer with only one window and one button, and a Labview DLL with only one empty VI. The button action is only load & then free the DLL.

Result : if I run this simple system doing nothing, the behavior is the same : I increase my application memory load from 100K each time I hit the button.

To be sure I test the same with other DLL ownmade from VC++ or with some commercial software DLL, no memory leakage. So my conclusion is that it comes from the Labview DLL construction.

 

 

Is this a know problem ? Does anyone have an idea how I can solve this ???

Thanks for your help! 

 

0 Kudos
Message 1 of 1
(2,033 Views)