LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

closing vi increases memory

I have an application that sits in a loop and dynamically loads and runs some VIs.

Depending on a initialization paramete, after the VI finishes I can either close the reference or keep it around.

If I have the program set to close the reference I would expect that V, associated subVIs, and memory associated with it to disappear.

However, I have on such VI (containing same Labview vision code and images) where the mere act of closing the reference causes the memory requirements to increase (in this case by about 25/30 Mbytes) and thus the application doesn't last long after that.

This all under development not in a built executable (not sure what happens there). 

If before I dynamically load that VI I open it from Labview and run it, the VI stays in memory, obviously, and the same increase in memory requirements happen when I click the VI by clicking on the close window x icon.

This is really weird, how can closing a whole VI hierarchy increase the memory requirements of Labview, while keeping it in memory doesn't?

This is LV 7.1 Vision 7.1

 

0 Kudos
Message 1 of 3
(2,704 Views)

Hey,

 

You can try adding  "IMAQ Dispose" with a TRUE wired to the "All Images" input to deallocate the image buffers. Maybe this is the cause.

 

Christian

0 Kudos
Message 2 of 3
(2,670 Views)

You need to close all the imaq images before closing the VI. So, using VI
server to abort the VI's won't do the trick.

The image type is a somewhat exotic type, and not as well integrated in
LabVIEW as other types. For all native LabVIEW references, the garbage
collection is very good...

You should find a way to communicate to the VI that it should finish itself.
For instance, use a user event, occurence, queue, or buffer vi (even a
global will do). It is a bit more complicated, since you want to send which
Vi should close. I'd make a user event with a string as type. The event,
"quit vi", is send when a particular VI should be closed. The VI receives
the event, and knows it should finish. So it jumps to the quit state, and
closes all images...

Regards,

Wiebe.


0 Kudos
Message 3 of 3
(2,662 Views)