Ask Your Question
1

memory deallocation

asked 2016-09-27 15:06:02 -0600

Nabeel gravatar image

OpenCV matrices can be declared in various ways. I am looking to declare openCV matrices in a main class and then populate them in member functions.

My question : I believe that openCV matrices will be deallocated automatically once the main class object goes out of scope !! Which means that I do not have to manually call release function of openCV matrices

Please correct me if I am wrong

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2016-09-28 03:18:01 -0600

kbarni gravatar image

You are right. OpenCV handles memory management for Mat objects.

OpenCV manages separately the Mat object and the data, so several Mat objects can share the same data (e.g. submatrices). OpenCV keeps track if data is still used, and when the data is not referenced anymore, it gets freed.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-09-27 15:06:02 -0600

Seen: 248 times

Last updated: Sep 28 '16