LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to clear an array of clusters with image info from memory - overflowing!

I am using a cluster with IMAQ interface name, session info, image array, and individual image and creating an array of that cluster. I try to clear the cluster by deleting the array elements, read an array of images, save them, and repeat the loop. Over time, though the arrays are tearing through all available RAM. I tried removing local variables (which I understand would save a copy of the entire array to memory every loop iteration) and had no luck - actually the code hangs now on the write function, where it thinks there is no image data. I didn't think I changed anything other than to direct wire where there had been local vars to pass information from one part of the sequence to the next. Help! (screenshots of code attached).
0 Kudos
Message 1 of 4
(3,377 Views)
more screencaps -
0 Kudos
Message 2 of 4
(3,376 Views)

Hi Nasgul,

 

please attach the VIs instead of 5 pics!

General comments:

- still lots of locals

- unneeded sequences

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 4
(3,357 Views)

Hi, Nasgul,

 

Not sure where you have resources leak - from your screenshots its not clear.

But one is clear - you may not understand that IMAQ Images in LabVIEW passed by references. So, if you want to create array of images, then for each element IMAQ Create should be called with different name, otherwise all elements referred to the same image. For example, if IMAQ Dispose will be called for the first elementh of the array, then other 9 images will be automatically invalid.

 

Compare two code snippets below:

 

ImagesAllocation.png

 

 

Common recipe for solving troubles with resources - reduce your application step by step by isolating parts of the code with case structures until application will be stable. Then you will found part of code which caused memory leak. 

 

best regards,

 

Andrey.

 

Message 4 of 4
(3,330 Views)