![]() |
IMAQ images and Memory Management
I have not seen any code that disposed of Image instances (i.e., GetImaqImage()). I do, however, see code delete the source image and then use the underlying Image instance, which leads me to believe that ImageBase is not the owner of the Image instance. Am I to assume that they are managed by the IMAQ vision library. I can see generating a lot of these Images during a competition and although they tend to be small I can easily run out of memory if the resource is not freed.
Thanks |
Re: IMAQ images and Memory Management
Destructor of ImageBase:
Code:
ImageBase::~ImageBase()Code:
protected: |
Re: IMAQ images and Memory Management
If you are working with pointers, you should just be able to delete the images out of memory each time through the loop once you are done processing them.
Image *genericImage = NULL; //Code to get value and store it in genericImage delete genericImage; |
Re: IMAQ images and Memory Management
Quote:
|
Re: IMAQ images and Memory Management
Ah, I have yet to look into the inner workings of the 7000 lines of nivision.h... I just went off of my prior C++ experience. Sorry for the misinformation.
|
Re: IMAQ images and Memory Management
There are versions of GetImage that take a pointer to an Image so you can allocate your own image data structure (once using new HSLImage() then set the size) and use it over and over again. This will be a bit faster. When programming in a real-time environment it is better to NOT be doing memory allocations or formatted output in loops where you hope to have deterministic (execute in the same amount of time each time through) performance.
HTH |
| All times are GMT -5. The time now is 17:40. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi