Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Solved.

The problem is i was in a different matrix, that i've passed from c++ code. When returning a matrix address from jni, i had to use:

Mat ret = getSomeMatrix();
return (jlong) new Mat(ret);

because the java constructor Mat(long addr) doesn't add a reference to the counter of the matrix, but the finalizer does remove one reference.

Solved.

The problem is i was in a different matrix, that i've passed from c++ code. When returning a matrix address from jni, i had to use:

Mat ret = getSomeMatrix();
return (jlong) new Mat(ret);

because the java constructor Mat(long addr) doesn't add a reference to the counter of the matrix, but the finalizer does remove one reference.