Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Release memory from innner class?

I am writing a class in and I'm unsure of memory management. I have several methods that receive a Mat() as input and return a Mat() as well. For example:

private Mat doSomething(Mat inMat){
   Mat nonZeros= Mat.zeros(inMat.size(), inMat.channels());
   Core.findNonZero(drawnRect, nonZeros);
   return nonZeroes;
}

I'm not sure how to relate to inMat and outMat in terms of memory, do I need to call release() on them at some point? If so how should I handle that in such a case, where the new Mat() declaration is in a different scope then the usage?