You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/05/05 14:09:44 UTC

[GitHub] [arrow] rymurr commented on a change in pull request #6956: ARROW-8481: [Java] Provide an allocation manager based on Unsafe API

rymurr commented on a change in pull request #6956:
URL: https://github.com/apache/arrow/pull/6956#discussion_r420135744



##########
File path: java/memory/src/main/java/org/apache/arrow/memory/UnsafeAllocationManager.java
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.memory;
+
+import org.apache.arrow.memory.util.MemoryUtil;
+
+/**
+ * Allocation manager based on unsafe API.
+ */
+public class UnsafeAllocationManager extends AllocationManager {
+
+  public static final Factory FACTORY = new Factory();
+
+  private final long allocatedSize;
+
+  private final long allocatedAddress;
+
+  protected UnsafeAllocationManager(BaseAllocator accountingAllocator, long requestedSize) {

Review comment:
       should this be private? Perhaps the class should be final too?

##########
File path: java/memory/src/main/java/org/apache/arrow/memory/BaseAllocator.java
##########
@@ -765,7 +765,7 @@ public static Config defaultConfig() {
      */
     @Value.Default
     AllocationManager.Factory getAllocationManagerFactory() {
-      return NettyAllocationManager.FACTORY;
+      return DefaultAllocationManagerOption.DEFAULT_ALLOCATION_MANAGER_FACTORY;

Review comment:
       As the default allocator is changing `RootAllocator` should probably have its defaults[1] changed so that it doesn't generate a default allocator when it wants a netty one.
   
   [1] https://github.com/apache/arrow/blob/dff612e6a468b46b7058757c24c638894101ba67/java/memory/src/main/java/org/apache/arrow/memory/RootAllocator.java#L51




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org