01-07-2009 09:00 AM
01-07-2009 10:03 AM
Ali Ghaderi -
Per the documentation, you must call imaqDispose() on the array that's returned (not the image) to free it. This should get rid of the memory leak.
Greg Stoll
Vision R&D
National Instruments
01-08-2009 02:27 AM
Thank you for the response. I have alerady read this somewhere else. However, I do not quite understand this. Since the only ImaqDispose function I find in the functions palette, gets rid of the image :mansad:
So I guess my question is how do one uses imaqDispose() on the array?
01-08-2009 09:26 AM
Ali Ghaderi -
imaqDispose() is used to dispose images as well as other memory allocated in our DLL (such as report structures), so it will work on both.
You should be able to call it on the array just like you would on an image, so if you have the code:
char* arrayData = imaqImageToArray(image, IMAQ_NO_RECT, NULL, NULL);
/* Processing goes here */
imaqDispose(arrayData);
and after the last imaqDispose() call the array will be destroyed and there will be no memory leak.
Greg Stoll
Vision R&D
National Instruments
01-08-2009 09:47 AM
Greg,
apparently I am a new comer who has no clue on what you are talking about. You are referring to a text base programming function which I do not see how I can implement in LabVIEW with the icon imaqDispose in the functions palette. I start to wonder if my installation is right. Can you send me a hint?
regards
Ali
01-08-2009 10:02 AM
Ali -
Oh, sorry, I thought you were talking about our CVI interface for some reason. My mistake!
You shouldn't have to do anything special to free the memory - LabVIEW should take care of that for you. Can you post a screenshot of your code?
Greg Stoll
Vision R&D
National Instruments
01-15-2009 09:05 AM
Hey,
I'd like to bump this, as I'm having the same issue.
I'm doing my master thesis right now and need to utilize the Harris Corner Finder. Using Labview this works great, however i stumbled upon a problem. Everytime I call the VI, the allocated memory increases by 1-5MB. I have broken it down to the VI with the corner finder in which I use the ImageToArray-VI.
As this phenomenon makes up around 300-500 MB per Picture, my program is useless after the 4th picture...
01-15-2009 10:57 AM
Der_schorsch -
Can you post a screenshot of your code?
Greg Stoll
Vision R&D
National Instruments
01-15-2009 11:09 AM - edited 01-15-2009 11:10 AM
Are you sure you're not accidentally leaking memory by creating extra IMAQ images and not destroying them? Is it possible the array data from ImageToArray is being saved into a growing shift register in your sub-VI that is never cleared?
I tested the below VI and did not see any leak:

-Eric
01-15-2009 11:53 AM
Hey,
I'm already home, but I will post the VI as soon as I am back in the lab tomorrow morning.