zhztheplayer commented on PR #13248:
URL: https://github.com/apache/arrow/pull/13248#issuecomment-1293242505

   @lidavidm Thanks a lot for taking the work on since I was too occupied by 
some other stuffs to keep watching on this these days.
   
   > 2) we need to expose some APIs from the memory-core package (we could 
avoid this by providing a formal API for 'foreign allocations', IMO)
   
   If we decide to follow this path, it probably be able to help that I had 
some design which I might mention once:
   
   
https://github.com/oap-project/arrow/blob/c4bd7cc1a45991aedf8e4ddd5533d798361d24c7/java/memory/memory-core/src/main/java/org/apache/arrow/memory/BufferAllocator.java#L55-L62
   
   This was to add API `BufferAllocator.buffer(MemoryChunk chunk)` to wrap a 
foreign memory chunk into a Arrow buffer then associate to an allocator.
   
   The interface `MemoryChunk` is like
   
   ```java
   public interface MemoryChunk {
     /**
      * The size (in bytes) of this chunk.
      *
      * @return size of this chunk (in bytes).
      */
     long size();
   
     /**
      * The native address indicating this chunk.
      *
      * @return the native address of this chunk.
      */
     long memoryAddress();
   
     /**
      * Destroy and reclaim all memory spaces of this chunk.
      */
     void destroy();
   }
   ```
   
   Would you think it could be helpful here?


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