westonpace commented on a change in pull request #10186:
URL: https://github.com/apache/arrow/pull/10186#discussion_r624106373



##########
File path: python/pyarrow/memory.pxi
##########
@@ -36,6 +36,15 @@ cdef class MemoryPool(_Weakrefable):
     cdef void init(self, CMemoryPool* pool):
         self.pool = pool
 
+    def release_unused(self):
+        """
+        Attempts to free any memory being held onto by an optimized allocator.
+        This function should not be called except potentially for benchmarking
+        or debugging as it could be expensive and detrimental to performance.
+        """
+        cdef CMemoryPool* pool = c_get_memory_pool()
+        pool.ReleaseUnused()

Review comment:
       Done.

##########
File path: cpp/src/arrow/memory_pool.h
##########
@@ -87,6 +87,11 @@ class ARROW_EXPORT MemoryPool {
   ///   faster deallocation if supported by its backend.
   virtual void Free(uint8_t* buffer, int64_t size) = 0;
 
+  /// Returns unused memory to the OS
+  ///
+  /// Only applies to allocators that hold onto unused memory

Review comment:
       Done.

##########
File path: cpp/src/arrow/memory_pool.h
##########
@@ -87,6 +87,11 @@ class ARROW_EXPORT MemoryPool {
   ///   faster deallocation if supported by its backend.
   virtual void Free(uint8_t* buffer, int64_t size) = 0;
 
+  /// Returns unused memory to the OS

Review comment:
       Done.




-- 
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:
[email protected]


Reply via email to