danepitkin commented on code in PR #37723:
URL: https://github.com/apache/arrow/pull/37723#discussion_r1374646996


##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/Accountant.java:
##########
@@ -73,12 +74,14 @@ public Accountant(Accountant parent, String name, long 
reservation, long maxAllo
     this.allocationLimit.set(maxAllocation);
 
     if (reservation != 0) {
-      // we will allocate a reservation from our parent.
-      final AllocationOutcome outcome = parent.allocateBytes(reservation);
-      if (!outcome.isOk()) {
-        throw new OutOfMemoryException(String.format(
-            "Failure trying to allocate initial reservation for Allocator. " +
-                "Attempted to allocate %d bytes.", reservation), 
outcome.getDetails());
+      if (parent != null) {

Review Comment:
   Small nit: you could do `if (reservation != 0 && parent != null)`. 



##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java:
##########
@@ -1111,7 +1116,9 @@ public void print(StringBuilder sb, int indent, Verbosity 
verbosity) {
 
     if (BaseAllocator.DEBUG && verbosity.includeHistoricalLog) {
       sb.append("\n");

Review Comment:
   We should move `sb.append()` into the `if (historicalLog != null)` scope.



##########
java/pom.xml:
##########
@@ -46,6 +46,7 @@
     <errorprone.javac.version>9+181-r4173-1</errorprone.javac.version>
     <error_prone_core.version>2.16</error_prone_core.version>
     <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
+    <checker.framework.version>3.38.0</checker.framework.version>

Review Comment:
   Should we try v3.39.0? It might be worth rebasing so that the Java 21 CI job 
can run to see if its required.



##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java:
##########
@@ -94,7 +95,9 @@ public ArrowBuf(
     this.readerIndex = 0;
     this.writerIndex = 0;
     if (BaseAllocator.DEBUG) {
-      historicalLog.recordEvent("create()");
+      if (historicalLog != null) {

Review Comment:
   small nit: maybe combine into one `if` statement here, too? There are a few 
instances of this.



##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/ArrowBuf.java:
##########
@@ -94,7 +95,9 @@ public ArrowBuf(
     this.readerIndex = 0;
     this.writerIndex = 0;
     if (BaseAllocator.DEBUG) {
-      historicalLog.recordEvent("create()");
+      if (historicalLog != null) {

Review Comment:
   Hmm, checking for both `BaseAllocator.DEBUG` and `historicalLog != null` is 
redundant. Maybe we just check for `historicalLog != null` everywhere to keep 
the code clean.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to