releasing native memory of temp `Mat` objects in generated Java code
authorAndrey Pavlenko <andrey.pavlenko@itseez.com>
Tue, 26 May 2015 10:50:56 +0000 (13:50 +0300)
committerAndrey Pavlenko <andrey.pavlenko@itseez.com>
Tue, 26 May 2015 10:58:54 +0000 (13:58 +0300)
modules/java/generator/gen_java.py

index fce172f..433e2ee 100755 (executable)
@@ -1153,6 +1153,7 @@ extern "C" {
                     if "O" in a.out:
                         if not type_dict[a.ctype]["j_type"].startswith("MatOf"):
                             j_epilogue.append("Converters.Mat_to_%(t)s(%(n)s_mat, %(n)s);" % {"t" : a.ctype, "n" : a.name})
+                            j_epilogue.append( "%s_mat.release();" % a.name )
                         c_epilogue.append( "%(t)s_to_Mat( %(n)s, %(n)s_mat );" % {"n" : a.name, "t" : a.ctype} )
                 else:
                     fields = type_dict[a.ctype].get("jn_args", ((a.ctype, ""),))