Skip to content

Commit

Permalink
* Make call to Pointer.physicalBytes() thread safe and remove lock…
Browse files Browse the repository at this point in the history
… (issue #231)
  • Loading branch information
saudet committed Mar 23, 2018
1 parent 2338929 commit 273d4bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Make call to `Pointer.physicalBytes()` thread safe and remove lock ([issue #231](https://github.com/bytedeco/javacpp/issues/231))
* Add `Info.enumerate` to let `Parser` map C++ enum classes to Java enum types ([issue #108](https://github.com/bytedeco/javacpp/issues/108))
* Prevent `Loader` from loading twice copies of the same DLL ([issue deeplearning4j/deeplearning4j#4776](https://github.com/deeplearning4j/deeplearning4j/issues/4776))
* Add a `BuildMojo.targetDirectory` parameter to set a directory containing Java files generated by `buildCommand`
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/bytedeco/javacpp/Pointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public static long maxPhysicalBytes() {

/** Returns the amount of physical memory currently used by the whole process, or 0 if unknown.
* Also known as "resident set size" (Linux, Mac OS X, etc) or "working set size" (Windows). */
@Name("JavaCPP_physicalBytes") public static synchronized native long physicalBytes();
@Name("JavaCPP_physicalBytes") public static native long physicalBytes();

/** Returns the amount of physical memory installed according to the operating system, or 0 if unknown.
* It should not be possible for {@link #physicalBytes()} to go over this value. */
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/bytedeco/javacpp/tools/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,7 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver
out.println(" char line[256];");
out.println(" char* s;");
out.println(" int n;");
out.println(" lseek(fd, 0, SEEK_SET);");
out.println(" if ((n = read(fd, line, sizeof(line))) > 0 && (s = (char*)memchr(line, ' ', n)) != NULL) {");
out.println(" if ((n = pread(fd, line, sizeof(line), 0)) > 0 && (s = (char*)memchr(line, ' ', n)) != NULL) {");
out.println(" size = (jlong)(atoll(s + 1) * getpagesize());");
out.println(" }");
out.println(" // no close(fd);");
Expand Down

0 comments on commit 273d4bc

Please sign in to comment.