LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event handler eats up memory. Bad programing and/or bug.

Hello

I've been programming a GUI for a project. The basics of the program is a sample routine that updates a array once a second. Once the array is updated I use a event handler to plot the new array in a graph.

When I wrote this gui I think I've stumbled upon a bug in Labviews memory allocation.

If you have two loops. One that builds a array and then signals a loop with a eventhandler that reads the array and the event handler is stoped for a few seconds (by opening a sub vi or something inside the event handler), the memory goes berserk. When the event handler is free after the stop the memory is still allocated and does not return.

I could not find any information on this problem in the forum so I thought I would share this information with everyone. I managed to reproduce this phenomena in a small example (attached), if anyone is interested in it. The problem is simple to fix once you recognize the problem. However it was not the simplest problem to find (imho that is ;)).



Regards

Andreas Beckman
0 Kudos
Message 1 of 11
(3,430 Views)
Where are you seeing the memory being allocated? What tool are you using, task manager or LabVIEW profiling? I'm not seeing what you describe (LV 7.1.1 on a 3.4 GHz Pentium 4 w/ 1 Gb memory)

Thanks,
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 11
(3,408 Views)
hi there

i can't see any memory allocation too with LV 7.1 under WinXP SP2.


best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 3 of 11
(3,402 Views)
Hello again.

When you press the "enable bug" - button and look at the amounth of memory the application has it should grow fast or at least it does over here. Im running the vi compliled. Lv 7.1 under a linux system.


Tnx for the reply.


Regards

Andreas Beckman
0 Kudos
Message 4 of 11
(3,400 Views)
hi there

i got no problems at all, but i'm running WinXP!!

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 11
(3,397 Views)
Hello Chris.

Ill have to get a hold of a WinXp machine and check this out. Maybe this is a linux bug or something.

Thanks for helping out.


Regards

Andreas Beckman
0 Kudos
Message 6 of 11
(3,382 Views)
If you change the event to 'Mouse Up' or 'Mouse Down', does the same behavior occur?
Randall Pursley
0 Kudos
Message 7 of 11
(3,354 Views)
Hello Randall.

It does not seem to have any effect to change the event to mouse down or mouse up.

The event is stoped so my guess is that labview begins to copy memory into some sort of queue and then when the event handler is released it never free:s up the memory (Just a guess. I have no ídea of how labviews internal memory handling works.).

Regards

Andreas Beckman
0 Kudos
Message 8 of 11
(3,345 Views)
One other thing. Put a probe in the iterative counter of the while loop. It would be interesting to see if for some reason the event in triggered several times instead of just the one time it is supposed to run.
Randall Pursley
0 Kudos
Message 9 of 11
(3,333 Views)
Hello Andreas!

I will run your program on a Linux Redhat 8.0 machine and if I can reproduce what you are experiencing and that the behavior differs from what will occur on a Windows machine I will write a bug-report as soon as possible.

Will keep you updated.

Regards,
Jimmie A.
Applications Engineer, National Instruments
Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 10 of 11
(3,300 Views)