Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Leak, Deallocating memory after using imaqImageToArray() function

I have created a program (LW/CVI- Imaq Vision), which uses a timer callback to acquire an image, convert the image to an array using the imaqImageToArray() function, manipulates the data in the array, converts the data to an image, displays the image, and disposes of the image(imaqDispose()), and apparently the imaqImageToArray() function clears the allocation pointer, however does not deallocate the memory, such that the next time the function is called again, imaq allocates new memory, thus eventually the application slows down and freezes due to lack of memory. Does anyone have any suggestions?
0 Kudos
Message 1 of 2
(3,079 Views)
Hello,

You need to call the imaqDispose() for the assigned pointer to actually clear the allocated memory.

iPointer = imaqImageToArray(imgInputImage,IMAQ_NO_RECT, &iCols, &iRows);
imaqDispose (iPointer);

Let me know if you have further questions regarding this.

Best regards,

Yusuf C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 2
(3,079 Views)