LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear arrays pragmatically

Dear all,

 

Does it exist a method such has IMAQ Dispose for arrays? 

I have a VI which receives several big 2D arrays (interface requirement). These are converted into IMAQ images and processed. In the last step of th VI resulting Images are again converted and returned as 2D arrays.

I would like to dispose the input arrays once they have been converted into images and thus liberate memory usage. Is there a way to do this pragmatically?

 

Best regards,

Esteban

0 Kudos
Message 1 of 30
(4,503 Views)

If you're just trying to clear your inputs, you can write to them using local variables... You don't usually need to do this though, so what's your reason? Once the data is passed through the inputs, clearing the arrays doesn't clear up memory.

 

Maybe what you really want is to inline your subVI. This removes all memory associated with the inputs and outputs. Check out the SubVI Overhead section here.

 

You should share the VI, so that we can better understand what you need.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 30
(4,498 Views)

Hey James,

 

For confidentiality reasons I can´t share the code here. 

The full code is a chain of sub VIs. Every subVI receives 2D arrays and returns 2D arrays. Inside every subVI the arrays are converted into IMAQ images for processing.

The chain causes the arrays to be copied many times, and it consumes a lot of memory. 

The requirements of the program is that every subVI have such interfaces.

I am wondering how to decrease the memory consumption. I guess disposing the input arrays after they are converted to images could help.

 

Best regards,

Esteban

0 Kudos
Message 3 of 30
(4,491 Views)

Why must the arrays be displayed with each subVI? This functionality is going to require that the memory space is used. Are they each popups every time they are run?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 4 of 30
(4,483 Views)

Can you post a stripped down version of your code?

 

Is there a reason you have to convert from an array to an image in every subVI?

0 Kudos
Message 5 of 30
(4,481 Views)

Dear all, 

 

I have created a little example. 

Imagine the chain of my SubVIs (called from a VI) are like the one shown in attachments.

The arrays are converted to IMAQ images to use the methods of the Vision tool box. 

Hope the example helps to clarify the problem.

 

 

PS: I´m not pretty sure how to dispose the images.  

 

regards, 

Esteban

0 Kudos
Message 6 of 30
(4,471 Views)

I cannot open your code (using LabVIEW 2014). Could you post a snippet or convert to 2014?

0 Kudos
Message 7 of 30
(4,462 Views)

Someone else I'm sure has 2015 on here who can help, but I'm still back in 2014.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 8 of 30
(4,460 Views)

Please try with this.

0 Kudos
Message 9 of 30
(4,435 Views)

Ok, it looks like you will want to destroy the images after you convert that image to an array, otherwise you don't know if the image will be destroyed before conversion or not. Also, you can use the error wires (along with others) to make sure your VIs execute in the desired order, the sequence structure is not necessary.

 

imaq snippet.png

0 Kudos
Message 10 of 30
(4,420 Views)