Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

ImageToArray causes memory overflow

hey,

 

it didn't leave me to rest, so I went back to the lab and here is the VI

 

 

0 Kudos
Message 11 of 17
(2,124 Views)

Funny I can't edit my post...

 

Nevertheless: I have tried to provoke the error on my Laptop, have failed though.  So it seems to be a Computer-related problem...

0 Kudos
Message 12 of 17
(2,117 Views)

Greg,

 

It is difficult to send you a screenshot of my code since it is quite large and consists of many SubVI-s. However, I wrote a new code which contains at least a part of the problem. Just run the test.vi with following parameters, Greylevel=150 and #CPU=2. I am using a greylevel image of tif format with the size of 50 MB. Just follow the amount of memory in use before running the program and after the stop button is pushed. Although I am releasing the image, after pushing the stop button, not all memory is released. In fact in my case, according to windows task manager, 300 MB are not released (this is 6 times the size of the image)! If I run this code with only one CPU core, this number is 200 MB (4 times the image size).

 

Do you have any advice?

 

Ali

Download All
0 Kudos
Message 13 of 17
(2,096 Views)
On my machine the amount of memory does go up after running the VI, but LabVIEW needs to allocate space for the entries in the various 2D arrays.  Running the VI again doesn't seem to use any more memory.
 
If the amount of memory being used by the arrays is the problem, the only real workaround is to show less data or not show the arrays at all - then LabVIEW will be able to reclaim that memory and the memory usage should go down.
 
Greg Stoll
Vision R&D
National Instruments
Greg Stoll
LabVIEW R&D
0 Kudos
Message 14 of 17
(2,081 Views)

Hey,

 

here's my VI attached (LAbView 8.5.1)  Still have the problem an my Lab-Computer

0 Kudos
Message 15 of 17
(2,065 Views)

Greg,

 

Let me see if I understand you right. Your advice is if memory is an issue then I should not use the  ImageToArray function. But rather work with lines of image, one at a time.

 

Ali

0 Kudos
Message 16 of 17
(2,063 Views)

Ali Ghaderi -

 

My advice would be to use ImageToArray, but after you're done using it don't wire it to an indicator or anything.  That should let LabVIEW know that it can clean it up and free the memory.

 

Greg Stoll

Vision R&D

National Instruments

Greg Stoll
LabVIEW R&D
0 Kudos
Message 17 of 17
(2,043 Views)