haohuaijin opened a new issue, #6439:
URL: https://github.com/apache/arrow-rs/issues/6439

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   -->
   See this comment 
https://github.com/apache/arrow-rs/issues/6363#issuecomment-2366788331,
   when the `Buffer`'s data is shared between many `Buffer`, the `capacity()` 
method will always return the total buffer memory usage, which causes the issue 
#6363, we need discussion the better memory track for shared buffers.
   
https://github.com/apache/arrow-rs/blob/d05cf6d5e74e79ddcacaa4a68bddaba230b0f163/arrow-buffer/src/buffer/immutable.rs#L166-L168
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   The easy way to do this is to return the length and the unused capacity of 
the `Buffer` like pr #6438,
   ```rust
       pub fn capacity(&self) -> usize {
           self.length + self.data.capacity() - self.data.len()
       }
   ```
                 This is changing what these methods report to something else 
that I'm not sure is correct. Whilst this formulation may benefit your 
use-case, there are common situations where it will now under report... Perhaps 
you might file a ticket to discuss a memory tracking approach that better 
handles shared buffers, as that is the actual issue here. This is not a bug
   
   _Originally posted by @tustvold in 
https://github.com/apache/arrow-rs/issues/6438#issuecomment-2367426442_
              
   But as @tustvold said, we need more discussion.
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features 
you've considered.
   -->
   
   
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request 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