lidavidm commented on a change in pull request #12603: URL: https://github.com/apache/arrow/pull/12603#discussion_r824186945
########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. Review comment: This sentence is a little redundant ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator Review comment: Maybe `BufferAllocator` and link to the Javadoc ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf Review comment: Maybe `ArrowBuf` and link to the Javadoc ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + Review comment: I would argue that "Reference counting" is a third major concept ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: Review comment: Arrow provides multiple modules, but users only need one or two of them: ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. Review comment: Hmm, the focus here is a little off IMO. Something like this: Arrow's memory management is built around the needs of the columnar format and using off-heap memory. Also, it is its own independent implementation, and does not wrap the C++ implementation. ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). Review comment: I'm not really sure what this tells us, what is the user learning here? ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. Review comment: ``` ``memory-core``: provides the interfaces used by the Arrow libraries and applications. ``` ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. Review comment: ``` ``memory-netty``: an implementation of the memory interfaces based on the [Netty](INSERT LINK HERE) library. ``` ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: Review comment: Again, for a beginner, I think we can have more explanation, and focus less on just replicating the README 1-1 ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. Review comment: "The concrete implementation of the allocator. Applications should generally create one allocator at the start of the program." The direct memory stuff should be described above, not here. Also, if we are referencing a class name, then just use the class name (ideally with a link to the docs), e.g. "RootAllocator", else it gets confusing ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. Review comment: and ditto ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. + +.. code-block:: Java + + try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE) ) { ; } + +ArrowBuf +======== + +The facade for interacting directly with a chunk of memory. + +Two important instance variables of an ArrowBuf: + +* Address: Starting virtual address in the underlying memory chunk that this ArrowBuf has access to. +* Length: Length (in bytes) in the underlying memory chunk that this ArrowBuf has access to. + Review comment: As suggested above we should have a section on reference counting. We should talk about remembering to `close()` objects here ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: Review comment: "Consider these guidelines:" ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. Review comment: "Remember to close() allocators after use (whether they are child allocators or the RootAllocator), either manually or preferably via a try-with-resources statement. Allocators will check for outstanding memory allocations when closed, and throw an exception if there are allocated buffers; this helps detect memory leaks." ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. + +.. code-block:: Java + + try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE) ) { ; } + +ArrowBuf +======== + +The facade for interacting directly with a chunk of memory. + +Two important instance variables of an ArrowBuf: + +* Address: Starting virtual address in the underlying memory chunk that this ArrowBuf has access to. +* Length: Length (in bytes) in the underlying memory chunk that this ArrowBuf has access to. Review comment: I don't think we need to elaborate on this so much. ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. Review comment: "Use the BufferAllocator interface in APIs instead of RootAllocator." ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. + +.. code-block:: Java + + try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE) ) { ; } + +ArrowBuf +======== + +The facade for interacting directly with a chunk of memory. Review comment: "ArrowBuf represents a single, contiguous allocation of direct memory. It consists of an address and a length, and provides low-level interfaces for working with the contents, similar to ByteBuffer. Unlike (Direct)ByteBuffer, it has reference counting built in (see the next section)." ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. Review comment: ```suggestion The memory modules contain all the functionality that Arrow uses to manage memory (allocation and deallocation). ``` ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. + +.. code-block:: Java + + try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE) ) { ; } Review comment: Java users know how to use try-with-resources. We should assume they are a beginner to Arrow, but are reasonably familiar with Java itself. ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. Review comment: We should elaborate on how and why Arrow uses direct memory ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: Review comment: "One of the interfaces defined by memory-core is BufferAllocator. This class is responsible for..." ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. + +.. code-block:: Java + + try (BufferAllocator allocator = new RootAllocator(Long.MAX_VALUE) ) { ; } + +ArrowBuf +======== + +The facade for interacting directly with a chunk of memory. + +Two important instance variables of an ArrowBuf: + +* Address: Starting virtual address in the underlying memory chunk that this ArrowBuf has access to. +* Length: Length (in bytes) in the underlying memory chunk that this ArrowBuf has access to. + +Memory Modules +============== + +Memory core define the bases to work with direct memory and the application decided to allocate arrow buffer bases on +the dependency added on your pom.xml (memory-unsafe or memory-netty). If any of these is not added the application raise +an exception. Review comment: This should just be one sentence as part of the list of modules above. "Applications should depend on memory-core and one of the two implementations, else an exception will be raised at runtime." We generally shouldn't talk about pom.xml. Not all people use Maven. ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. Review comment: Why do we want to use child allocators? ########## File path: docs/source/java/memory.rst ########## @@ -0,0 +1,82 @@ +.. 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. + +================= +Memory Management +================= + +The memory management package contains all the memory allocation related items that Arrow uses to manage memory. +This section will introduce you to the major concepts in Java’s memory management: + +* Allocator +* Arrowbuf + +.. contents:: + +Getting Started +=============== + +Java memory implementation is independently from C++ (not a wrapper around). +Java memory was implemented considering these specifications: Arrow Columnar Format and Java Off Heap references. + +.. note:: + + Java Memory Data = Data (Columnar mode reference) + Metadata (Flatbuffers serialization reference). + +These are the java memory modules: + +* Memory Core: Core off-heap memory management libraries for Arrow ValueVectors. +* Memory Netty: Netty allocator and utils for allocating memory in Arrow. +* Memory Unsafe: Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + +Allocators +========== + +Memory core module define the next allocators: + +* Buffer Allocator: The public interface application users should be leveraging. +* Root Allocator: A root allocator for using direct memory. Typically only one created for a JVM. + +Arrow provides a tree-based model for memory allocation. The RootAllocator is created first, +then all allocators are created as children of that allocator. The RootAllocator is responsible +for being the master bookkeeper for memory allocations. + +Please consider this note on your development: + +* Use BufferAllocator instead of RootAllocator in your allocator creation. +* Create your allocator inside of a try-with-resources statement. Review comment: Allocators have a debug mode, IIRC, that makes it easier to figure out where a leak originated -- 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]
