LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET event callback memory leak

Hello

 

I am stucked with a very annoying .NET memory problem. When I build vi's with .NET event callbacks and run them for a long time the application fills up the system memory continiously. My last test started with a application builder *.exe with one callback. I started on friday with a memory consumption of about 40MB and ended on monday morning with a consumption of 850MB. Also the cpu load increased in thes time from about 0 to 25%.

The on change event was triggerd about every 50ms and the callback vi was very simple, nearly only increasing a global numeric. Ate the end the value was about 900000 so the callback was triggerd 900000 times.

 

Here I have now attached vi with the same problem. It is a slight modification of the labview's build in .NET example with an increased event timing of every 5ms.

 

Hope someone can help me to find out from where these things are coming 

 

I always try to close every refernce in the callback so I hope this is not the fundamental problem.

 

Thanks in advance

 

Best regards

 

Gernot

 

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 1 of 12
(5,531 Views)
The example that you modified uses a private assembly that's in the examples folder. Without seeing the code for that private assembly it's hard to say whether the leak is in the assembly or in the LabVIEW <--> .NET interface layer. I would try to create a similar VI that uses a standard .NET class to see if the same thing happens.
0 Kudos
Message 2 of 12
(5,506 Views)

Thank you for this idea

 

I have alredy veryfied this, but used the LV build in example to show the problem.

I also used the mscorlib. Timer to verify. I set the timer interval to 5ms and have seen the identical problem.

So it seems not to be a .NET assembly problem or framework problem but a LV problem when using .NET.

 

I also verified by using Visual Basic .NET where it is no problem.

 

Cheers

 

Gernot

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 3 of 12
(5,493 Views)

Hi smercurio, Hi Gernot,

I already handled this issue with Gernot in a support request. I was able to reproduce the issue also with the  mscorlib. Timer and I´ll ask for explanation to our R&Dcause it seems to be a known issue.

Best regards.

 

Andrea Perin

Application Engineer

NI Germany 

Message 4 of 12
(5,486 Views)

Sorry for the duplicate way to find the solution.

 

Thank all for the help

 

Gernot

Gernot Hanel
IONICON Analytik Gesellschaft m.b.H.
0 Kudos
Message 5 of 12
(5,478 Views)

Resurrecting an old thread, was this ever resolved?

0 Kudos
Message 6 of 12
(4,370 Views)
That was 7 years ago, so probably. Are you having a problem?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(4,354 Views)

Yes certainly long enough that this should have been fixed by now. I asked as perhaps I am doing something silly.

 

I have a problem which I have exhaustively (as in physically exhausting) proven to be caused by a .NET callback hogging memory.

 

I have implemented a simple timer/scheduler mechanism that fires off a User Event, and at its core is a .NET time object which I have wrapped in a LabVIEW class to make nice and east to use. The code works great (see footnote), but over time memory just slowly runs away. Disabling the timers completely fixes the problem. I have created a messaging framework, so I thought I had a memory leak somewhere in that.

 

Attached is a bif of the Timer class code, am I doing something stupid here?

 

 

 

*except for the fact that the callback was never released which caused my class to remain locked. Silver lining here is that in my attempt to understand the problem I stumbled upon this bug note, which does indeed fix that particular problem.

Download All
0 Kudos
Message 8 of 12
(4,342 Views)

I am facing the problem of memory leak when I use event callback vi in LabVIEW2014 SP1. I am fetching images from .Net dll and it is consuming memory and application crash after certain amount of time. If i stop the vi, the callback vi is in the running state and doesn't allow me to edit. How to resolve this problem?

0 Kudos
Message 9 of 12
(4,257 Views)

Hi Neil,

 

Were you able to resolve this issue? If yes, can you please advise me on the solution?

 

Thanks,

Pranay

0 Kudos
Message 10 of 12
(3,131 Views)