LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW crash

Here is LabVIEW code with error

Vasilich2004_0-1684527305354.png

During few minutes 32 bit LabVIEW reaches 4 GB memory limit and crashes. Here is error message of this test application:

Vasilich2004_1-1684527397335.png

Error message doesn't have any information about which vi brought crash. In real application Windows kills LabVIEW and its message doesn't have any sense. Unfortunately, it is hard to find such bugs.

Can LabVIEW be more helpful?

 

P.s. LabVIEW manual could be more helpful. In Unregister For Events Function: "National Instruments recommends that you unregister for events when you no longer need to handle them. If you do not unregister for events, LabVIEW continues to generate and queue the events as long as the VI runs, even if no Event structure is waiting to handle them, which consumes memory and can hang the VI if you enable front panel locking for the events." Crash isn't mentioned.

 

Message 1 of 12
(1,410 Views)

The Reg Events should be done outside the loop. Here you are creating a new Event Registration Refnum every 10ms, which you never close. This will rapidly eat up RAM until LabVIEW crashes.

 

Here I put the Reg Events before the loop, and added an Unregister for Events after the loop:

raphschru_0-1684529789264.png

 

 

Regards,

Raphaël.

0 Kudos
Message 2 of 12
(1,400 Views)

i, specially(!), put inside because vi with such error are called multiply times.

0 Kudos
Message 3 of 12
(1,385 Views)

If for whatever reason you want to put the "Register for Events" inside the loop, then you must put an "Unregister for Events" inside the loop as well. Each refnum opened in LabVIEW has to be closed with the appropriate function, without which there will be memory leaks. It is the same for VI references, queues, notifiers, etc …

0 Kudos
Message 4 of 12
(1,375 Views)

Asked question -"Can LabVIEW be more helpful?"

 

0 Kudos
Message 5 of 12
(1,362 Views)

@Vasilich2004 wrote:

i, specially(!), put inside because vi with such error are called multiply times.


I think you should tell us more about this.  I can't think of a reason why I'd want to keep opening new references to the same event just to release them in the same case.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 12
(1,294 Views)

Please explain how your code is intended to work.  It's crashing because you're blowing out your memory. Ok. How is your code intended to work? No, I'm not asking why did you do it that way? No, I just want to know how your code was intended to work.

 

Thank you.

0 Kudos
Message 7 of 12
(1,244 Views)

There is an intend to show how easy LabVIEW could crash without any point on vi with error.

Hopefully, someone from NI reads about that.

0 Kudos
Message 8 of 12
(1,232 Views)

@Vasilich2004 wrote:

There is an intend to show how easy LabVIEW could crash without any point on vi with error.

Hopefully, someone from NI reads about that.


I haven't the slightest clue what you are talking about.  You can make any programming language crash easily if you want to.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 12
(1,212 Views)

First, to solve the memory issue, i think this should be enough :

 

TiTou_0-1684745128668.png

 

Now for your question."Can LabVIEW be more helpful?"

Well yes.. LabVIEW isn't perfect, getting a crash with a message that isn't helpful at all is very frustrating.

I have to say though, about 50% 20% of the time, if you copy past the crash message in google in find a forums post from someone with a similar issue and it give you a hint of where to dig.

 

I was a bit surprised/disappointed to not get a warning on this VI to say "hey, you have an event structure registering to a dynamic event, LabVIEW recommends to place an 'unregister node' somewhere, and by the way to learn more about caveats of dynamic event, make sure you read this white-paper : <insert useful link>"

 

Is NI going to put effort into making this more robust.. it would be nice, but I wouldn't hold my breath.

 

 


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 10 of 12
(1,189 Views)