LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.Net RefNum problem in loop


@jaketc wrote:
On my last test,  LV threw invalid parameter and/or memory errors. In the first case, the refnum was 0x0000 at error.   Which I suspect was a result of the memory error.  Possibly another memory leak?  There are many loops that open constructors then call various methods. I definitely found one - a constructor was being called inside the loop and closed outside of the loop.  The loop, in this case, was checking to see if  “transfer complete”. On true (or timeout 3s which doesn’t seem to work) the loop would terminate, with the refnum being passed to “close session” LV  primitive. Since the loop doesn’t terminate the constructor keeps being called until it runs out of memory and LV hangs.  

Things change if LabVIEW crashes.

 

I've seen native dll calls wrapped in .NET crash under the weirdest circumstances.

 

A simple API call (GetLastError or something) wrapped in .NET method crashes for instance (last time I checked) if you put it in VI in a while loop and run it for a while (10 sec.), then stop the loop and call the VI manually 5 times... Always 5 times...

 

I do think there's something fishy in LabVIEW.

 

This seemed to be related with loading\unloading of the external code. One way to prevent this crash was to keep a VI with the assembly running (doing nothing), so the dll wouldn't be loaded\unloaded... Weird, because I don't think LV unloads\loads the assemblies in the first place. There might be another 'running', 'in use' or 'active' state under the hood.

 

This doesn't seem to be happening in your example, but it you get really weird crashes, keep it in mind.

 

Also, I didn't loose references...

Message 11 of 11
(301 Views)