Wednesday, May 28, 2008

How to manage the image in memory?

Both of cvLoadImage and cvCreateImage would allocate a new memory space for image..
After you use that two function, you need cvReleaseImage funtion to release that.
Before you release them , a good habit is to use if(image) to detect if it's NULL..


Also..new and delete is allocating and release function in cpp.Please remember that new function will return a pointer..so you can't use it like this : int a =new int;

for example:
int* a=new int;
delete a;


for array:
int *a=new int[100]
delete[] a;

No comments: