LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW .NET dll functions

Hi,

 

In an application written in C# we are using a .NET DLL generated with application builder.

 

The DLL has 2 functions, the constructor for the dll and the function we are interested in.

We are passing as argument a large set of data which will be copied by labVIEW to run the function. As a result the application use quite a lot of memory.

 

The 2nd function is compiled as a

 

static void func(args...).

 

Since the function is static, it does not released the used memory after the call.

 

Is there a way to have the function in the dll not as static?

Or is there a way to have all the resources release after the of the function?

 

Thanks in advance. 

 

0 Kudos
Message 1 of 6
(3,111 Views)

Hi, what do you mean with "Is there a way to have the function in the dll not as static?" Do you want to change the class of the function inside of the dll? 

0 Kudos
Message 2 of 6
(3,075 Views)

Hi,

 

Thanks for your answer.

 

The main idea is that the labview function releases the memory. 

If believe that since the function is compiled as "static" by the app builder might be the root cause for the resources not be be reliesed.

 

It is why I have this question, is there any option to have the function as nont static?

 

Since there is a constructor for the class, there is no need for the function do be static, then we could dispose the class when it is not necessary anymore. In the case of static function inside a class memory isn't released.

 

I hope I could clarify.

 

BR

0 Kudos
Message 3 of 6
(3,063 Views)

I just want to narrow down this issue as much as possible. Your application is written on C# or LabVIEW? Second, you are using a .net dll that was generated using the application builder and now you are using that dll in your main application but it is consuming a lot of memory resources which you would like to release after the execution, is that correct?

0 Kudos
Message 4 of 6
(3,033 Views)

Hi,

 

The application is written in C#.

 

The .net dll is generated by application builder from a project that has only 1 VI.

 

The C# application acquires a large set of data that is given as argument to the function (VI) in the dll. Function returns only a couple of doubles.

We can see that at the first call of the function, the memory reserved for labVIEW RT engine grows very big and it's size never decreases after that call.

What we want is this memory to be released.

 

I hope I could clarify the situation.

 

Thanks for the help.

 

BR

0 Kudos
Message 5 of 6
(3,021 Views)

Hi MarC,

 

You won’t be able to unload the memory using LabVIEW. The memory not being deallocated is actually the expected behavior, but from what I understand there may be a way to change this in C#. You should be able to use the Unload method if you create a new application domain to run your LabVIEW DLL in, and then you can unload the assembly when it’s finished executing. Hope this helps.

Paul C
0 Kudos
Message 6 of 6
(2,995 Views)