From 72ec9c159ecb793c608bc9fc95d2cbfe5ce62c54 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Tue, 26 May 2015 13:50:56 +0300 Subject: [PATCH] releasing native memory of temp `Mat` objects in generated Java code --- modules/java/generator/gen_java.py | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/java/generator/gen_java.py b/modules/java/generator/gen_java.py index fce172fdc2..433e2eea50 100755 --- a/modules/java/generator/gen_java.py +++ b/modules/java/generator/gen_java.py @@ -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, ""),))