From 0ce97fc8f0b0eb775b921cd47ae2928caadc68f2 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Sat, 8 May 2021 10:25:51 +0900 Subject: [PATCH] Skip some more potentially `synchronized` code in `Pointer` with "org.bytedeco.javacpp.nopointergc" (issue tensorflow/java#313) --- src/main/java/org/bytedeco/javacpp/Pointer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bytedeco/javacpp/Pointer.java b/src/main/java/org/bytedeco/javacpp/Pointer.java index 274505dd8..c8e58ade4 100644 --- a/src/main/java/org/bytedeco/javacpp/Pointer.java +++ b/src/main/java/org/bytedeco/javacpp/Pointer.java @@ -283,7 +283,7 @@ static class DeallocatorReference extends PhantomReference implements D DeallocatorReference(Pointer p, Deallocator deallocator) { super(p, referenceQueue); this.deallocator = deallocator; - this.bytes = p.capacity * p.sizeof(); + this.bytes = p.capacity != 0 && referenceQueue != null ? p.capacity * p.sizeof() : 0; this.count = new AtomicInteger(0); }