Opencv Mat Memory Release

Browse other questions tagged android c opencv memory leaks android ndk or ask your own question.
Opencv mat memory release. It s obvious that this memory was allocated as a part of resd which means you have to check the code and find out how the variable resd was declared initialized and then do the appropriate procedure to release it. The method uses the following algorithm. Initialize the new header. If the current array shape and the type match the new ones return immediately.
If you re new to opencv you need to know exactly how to manage all the huge amounts of memory you re using. This is one of the key mat methods. Since i know a litle bit about opencv i can tell that resd is an iplimage. So src release still thinks there s nothing to do.
Most new style opencv functions and methods that produce arrays call this method for each output array. Oh note that mat s created with a borrowed pointer don t release the borrowed memory. The overflow blog podcast 267. C c isn t a garbage collected language like java so you need to manually release memory as soon as its use is over.
I guess the err is due to recycling that src mat for the resize operation.