alamb commented on issue #9057:
URL: 
https://github.com/apache/arrow-datafusion/issues/9057#issuecomment-1915425281

   Interestingly, I wrote an example / test 
   ```rust
       /// # Example:
       /// ```
       /// use datafusion_execution::memory_pool::proxy::VecAllocExt;
       /// // track how much memory is allocated in the vec
       /// let mut allocated = 0;
       /// let mut vec = Vec::new();
       /// // Push data into the vec and the accounting will be updated to 
reflect
       /// // memory allocation
       /// vec.push_accounted(1, &mut allocated);
       /// assert_eq!(allocated, 8); // space for 2 u32s
       /// vec.push_accounted(1, &mut allocated);
       /// assert_eq!(allocated, 8); // no new allocation needed
       ///
       /// // push more data into the vec
       /// for _ in 0..10 { vec.push_accounted(1, &mut allocated); }
       /// assert_eq!(allocated, 40); // underlying vec has space for 10 u32s
       /// assert_eq!(vec.allocated_size(), 40);
       /// ```
   ```
   
   And this fails:
   ```
   assertion `left == right` failed
     left: 48
    right: 40
   
   Left:  48
   Right: 40
   <Click to see difference>
   ```
   
   As I think the logic is incorrect


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