From 5b00d9da49d40f4c63f910460ebb5cb2a2225407 Mon Sep 17 00:00:00 2001 From: Andrey Pavlenko Date: Tue, 26 May 2015 13:10:54 +0300 Subject: [PATCH] releasing native memory in Java converters --- .../java/generator/src/java/utils+Converters.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/java/generator/src/java/utils+Converters.java b/modules/java/generator/src/java/utils+Converters.java index 49c0844a8..21a4e93fd 100644 --- a/modules/java/generator/src/java/utils+Converters.java +++ b/modules/java/generator/src/java/utils+Converters.java @@ -501,7 +501,9 @@ public class Converters { for (Mat mi : mats) { MatOfPoint pt = new MatOfPoint(mi); pts.add(pt); + mi.release(); } + mats.clear(); } // vector_vector_Point2f @@ -517,7 +519,9 @@ public class Converters { for (Mat mi : mats) { MatOfPoint2f pt = new MatOfPoint2f(mi); pts.add(pt); + mi.release(); } + mats.clear(); } // vector_vector_Point2f @@ -547,7 +551,9 @@ public class Converters { for (Mat mi : mats) { MatOfPoint3f pt = new MatOfPoint3f(mi); pts.add(pt); + mi.release(); } + mats.clear(); } // vector_vector_Point3f @@ -590,7 +596,9 @@ public class Converters { for (Mat mi : mats) { MatOfKeyPoint vkp = new MatOfKeyPoint(mi); kps.add(vkp); + mi.release(); } + mats.clear(); } public static Mat vector_double_to_Mat(List ds) { @@ -689,7 +697,9 @@ public class Converters { for (Mat mi : mats) { MatOfDMatch vdm = new MatOfDMatch(mi); lvdm.add(vdm); + mi.release(); } + mats.clear(); } // vector_vector_char @@ -719,6 +729,8 @@ public class Converters { List lb = new ArrayList(); Mat_to_vector_char(mi, lb); llb.add(lb); + mi.release(); } + mats.clear(); } }