Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit cc9455e

Browse files
author
servadmin
committed
Updated
1 parent e0ad7d9 commit cc9455e

23 files changed

+13
-9
lines changed

.gitignore

100644100755
File mode changed.

.project

100644100755
File mode changed.

README.md

100644100755
Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ which is currently 3.2.0:
2222

2323
### The current way to free native memory
2424

25-
OpenCV 2.4 and 3.2 use a Python code generator
25+
OpenCV 2.4 through 4.0.0-pre use a Python code generator
2626
`modules/java/generator/gen_java.py` to generate Java bindings during the build
2727
process. The generated code to free native resources looks like:
2828

@@ -286,6 +286,18 @@ to do things incorrectly.
286286
* [Opencv sgjava](https://github.com/Itseez/opencv/pull/4014)
287287
* [New Java memory mgt doc](https://github.com/Itseez/opencv/pull/4019)
288288
* [Added finalize back in](https://github.com/Itseez/opencv/pull/4029)
289+
* [Get rid of finalizers in Java bindings](https://github.com/opencv/opencv/issues/8683)
290+
291+
#### Fix template
292+
* Edit `modules/java/generator/templates/java_class.prolog`
293+
* Find
294+
```
295+
public final long nativeObj;
296+
```
297+
* Change to
298+
```
299+
public long nativeObj;
300+
```
289301

290302
#### Fix Mat
291303
* Edit `modules/core/misc/java/src/java/core+Mat.java`
@@ -307,14 +319,6 @@ public void free() {
307319
}
308320
}
309321
```
310-
* Find
311-
```
312-
public final long nativeObj;
313-
```
314-
* Change to
315-
```
316-
public long nativeObj;
317-
```
318322

319323
This will create a free() method that replaces finalize() thus you must make
320324
sure you call free() when you are done with the Mat. I also removed the final

build.xml

100644100755
File mode changed.

images/OpenCVFree_locks1.png

100644100755
File mode changed.

images/OpenCVFree_locks2.png

100644100755
File mode changed.

images/OpenCVFree_no_gc1.png

100644100755
File mode changed.

images/OpenCVNewMat_gc1.png

100644100755
File mode changed.

images/OpenCVNewMat_no_gc1.png

100644100755
File mode changed.

images/OpenCVRelease_locks1.png

100644100755
File mode changed.

images/OpenCVRelease_locks2.png

100644100755
File mode changed.

images/OpenCVRelease_no_gc1.png

100644100755
File mode changed.

images/OpenCVRelease_no_gc2.png

100644100755
File mode changed.

images/title.png

100644100755
File mode changed.

manifest.mf

100644100755
File mode changed.

nbproject/build-impl.xml

100644100755
File mode changed.

nbproject/genfiles.properties

100644100755
File mode changed.

nbproject/project.properties

100644100755
File mode changed.

nbproject/project.xml

100644100755
File mode changed.

src/com/codeferm/opencv/OpenCVFindContours.java

100644100755
File mode changed.

src/com/codeferm/opencv/OpenCVFree.java

100644100755
File mode changed.

src/com/codeferm/opencv/OpenCVNewMat.java

100644100755
File mode changed.

src/com/codeferm/opencv/OpenCVRelease.java

100644100755
File mode changed.

0 commit comments

Comments
 (0)